0

In our departement we have a blade system with one master node and four slave nodes that are connected to the master node. The system uses its own subnet (192.168.1.x) and only the master node is connected to the intranet (and thereby to the internet). On every node runs CentOS 5. I would like to update CentOS (by using yum). How to update the slave nodes as they don't have direct access to the intranet/internet. Could you please lead me in the right direction how to setup a forwarding/routing so that the slave nodes can do requests to the intranet/internet, too?

More details about the setup:
- master node
eth1 161.42.9.9
eth0 192.168.1.254
gateway 161.42.9.1

- 4 slave nodes
Connected to master eth0
IPs 192.168.1.1-4 (fetched using DHCP running on master)
gateway 192.168.1.254

Only 161.42.9.9 (=master) is allowed to access the internet (by using a proxy).

mfinni
  • 36,144
  • 4
  • 53
  • 86
medihack
  • 145
  • 1
  • 1
  • 6

1 Answers1

2

If you want to provide Internet access using the same public IP address, you need to use iptables to do SNAT (source NAT):

iptables -o eth1 -A POSTROUTING -s 192.168.1.1 -j SNAT --to-source 161.42.9.9
iptables -o eth1 -A POSTROUTING -s 192.168.1.2 -j SNAT --to-source 161.42.9.9
iptables -o eth1 -A POSTROUTING -s 192.168.1.3 -j SNAT --to-source 161.42.9.9
iptables -o eth1 -A POSTROUTING -s 192.168.1.4 -j SNAT --to-source 161.42.9.9

You need also to enable IP forwarding on the master node. Run as root:

# echo 1 > /proc/sys/net/ipv4/ip_forward
Khaled
  • 36,533
  • 8
  • 72
  • 99