Tuesday, August 25, 2009

Setting up private network

Assumption:

----> M2 <--------------------> M3--
| -----------------------------------------|
M1 ------------------------------------M4


M2 and M3 are servers
M1 and M4 are clients

M1 - 10.18.71.238
M2 - 10.18.71.1
M3 - 10.18.207.1
M4 - 10.18.207.180


Hardware connections
1) All are single homed (They have only one ethernet slot)
2) There are 2 network switches (M1 and M2 are connected to one switch; M3 and M4 are connected to the other switch. These hubs are directly connected so that M2 and M3 are connected
3) All of these switches are just accept and forward type of switches

Configurations

On Clients
M1
1) Assign the ip
ifconfig eth0 10.18.71.238/24
2) Set the default gw as 10.18.71.1 (M2)
ip route flush all
route add net 10.18.71.0/24 dev eth0 ( This means, if you need connection to the local n/w, try anywhere where you find eth0)
route add default gw 10.18.71.1


M4
1) Assign the ip
ifconfig eth0 10.18.207.180/24
2) Set the default gw as 10.18.207.1 (M3)
ip route flush all
route add net 10.18.207.0/24 dev eth0 ( This means, if you need connection to the local n/w, try anywhere where you find eth0)
route add default gw 10.18.207.1

Check: Now M1 should be pingable to/from M2 and M3 should be pingable to/from M4. If these are NOT pinging, something else might be wrong. Resolve this before proceeding further

On servers
M2
1) Assign the ip
ifconfig eth0 10.18.71.1/24
2) Make this as a router
ip route flush all
route add -net 10.18.71.0/24 dev eth0
route add -host 10.18.207.1 dev eth0
route add -host 10.18.207.180 gw 10.18.207.1
echo 1 > /proc/sys/net/ipv4/ip_forward

M3
1) Assign the ip
ifconfig eth0 10.18.207.1/24
2) Make this as a router
ip route flush all
route add -net 10.18.207.0/24 dev eth0
route add -host 10.18.71.1 dev eth0
route add -host 10.18.71.238 gw 10.18.71.1
echo 1 > /proc/sys/net/ipv4/ip_forward

Check : Now M2 --> M3 should be pingable

Now the private network is establised. All machines should be pingable from/to all machines

P.S- Make sure to disable Firewalls of all machines (iptables --flush; iptables -t nat --flush; verify iptables -L and iptables -t nat -L. This should NOT have any entries in them

No comments:

Post a Comment