Vmware 实验网搭建

来源:互联网 发布:nginx lbs lua 编辑:程序博客网 时间:2024/05/16 11:03

 3台机器搭建实验网,利用Vmware Team功能,建立两个独立的LAN

 

A: LAN1

B: LAN1       LAN2

C:                 LAN2

 

A : 192.168.2.10      dev     eth0

B : 192.168.2.1        dev     eth0

     192.168.3.1        dev     eth1

C : 192.168.3.10      dev     eth0

 

A<->B之间通过C来转发

 

配置A的路由表

route add -net 192.168.3.0/24 gw 192.168.2.1 dev eth0

 

配置B的路由表

route add -net 192.168.2.0/24 gw 192.168.2.1 dev eth0

route add -net 192.168.3.0/24 gw 192.168.3.1 dev eth1

开启ip转发

sysctrl net.ipv4.ip_forward=1

sysctrl -p

 

配置C的路由表

route add -net 192.168.2.0/24 gw 192.168.3.1 dev eth0

 

应该可以ping通了

-----------------------------------------------------------

附录:

在linux下设置永久路由的方法:

1.在/etc/rc.local里添加
方法:
route add -net 192.168.3.0/24 dev eth0

route add -net 192.168.2.0/24 gw 192.168.3.1


2.在/etc/sysconfig/network里添加到末尾
方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev


3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y

 

 

原创粉丝点击