网络环境:
真机A1:192.168.0.19
虚拟机A2:10.19.0.218
真机B1:192.168.0.20
虚拟机B2:10.20.0.219
需求:要求A2 和B2 正常通信.
修改/etc/sysctl.conf net.ipv4.ip_forward = 1
# ip route add 10.20.0.0/24 via 192.168.0.20
// 要访问10.20.0.0 网段的ip需要通过192.168.0.20 路由访问!
# ping 10.20.0.219
PING 10.20.0.219 (10.20.0.219) 56(84) bytes of data.
64 bytes from 10.20.0.219: icmp_seq=1 ttl=63 time=123 ms
64 bytes from 10.20.0.219: icmp_seq=2 ttl=63 time=0.487 ms
64 bytes from 10.20.0.219: icmp_seq=3 ttl=63 time=0.474 ms
64 bytes from 10.20.0.219: icmp_seq=4 ttl=63 time=0.456 ms
64 bytes from 10.20.0.219: icmp_seq=5 ttl=63 time=0.464 ms
好了,可以了,也可以使用 ip route del 10.20.0.0/24 删除这个静态路由表!
# vim /etc/sysconfig/network-scripts/route-br0 (route-xxx 根据自己情况定)
写入如下内容即可!
ADDRESS0=10.20.0.0
NETMASK0=24
GATEWAY0=192.168.0.20
阅读(650) | 评论(0) | 转发(0) |