Sunday 9 August 2009

A linux machine can be used as a router.

A linux machine can be used as a router.
eg:
you have a system with class A ip address and another system with class B ip address, in that case a linux system can be used to connect these two systems and this system will act as a router.

nodeA: 172.168.1.1
nodeB: 10.10.1.1

the router system should be configured with two or three virtual ipaddress.
one with 10.10.1.2 and another with 172.168.1.2

nodeA: nodeC : node B
Assign the node C with 192.168.1.8
#netconfig -d eth0
then again assign the node C with 2 virtual ip
#netconfig -d eth0:1 ->10.10.1.2
#netconfig -d eth0:2 ->172.168.1.2
assign these two virtual ip as the gateway ip for node A and node B
Assign node A with
#netconfig -d eth0

172.168.1.1 with gateway as 172.168.1.2
Assign node B with
#netconfig -d eth0
10.10.1.1 with gateway as 10.10.1.2
In node C
#vi /etc/sysctl.conf
and replace the line
net.ipV4.ip_forward =0 with net.ipV4.ip_forward =1
#sysctl -p
#service network restart
by doing this the node A can communicate with node B thru' node C

No comments:

Post a Comment