本实例要说明的是:实现10.0.0.0/24网段与192.168.2.0/24网段相互访问.

本实例要阐明的是:完成10.0.0.0/24网段与192.168.2.0/24网段彼此拜访.
过程1:检查本机IP地址
[root@localhost root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:A7:6E:77
inet addr:10.0.0.120 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2418 errors:0 dropped:0 overruns:0 frame:0
TX packets:1293 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1000347 (976.9 Kb) TX bytes:192592 (188.0 Kb)
Interrupt:10 Base address:0x2024
过程2:增加路由规矩
[root@localhost root]# route add -net 192.168.2.0/24 eth0

Linux下怎么完成不同网段之间的拜访(linux如何实现不同网段相互访问)  Linux 不同网段 访问 实例说明 第1张

过程3:检查路由规矩
[root@localhost root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0

注:route规矩中,有必要一起存在两个网段,不然,一个网段的IP地址将无法拜访到另一网段的IP地址。
过程4:检测本地机(IP:10.0.0.120)与长途机(IP:192.168.2.80)是否可互访.
[root@localhost root]# ping 192.168.2.80
PING 192.168.2.80 (192.168.2.80) 56(84) bytes of data.
64 bytes from 192.168.2.80: icmp_seq=1 ttl=127 time=5.51 ms
64 bytes from 192.168.2.80: icmp_seq=2 ttl=127 time=3.17 ms

过程5:删去路由规矩
[root@localhost root]# route del -net 192.168.2.0/24 eth0

【修改引荐】

  1. 浅谈Linux环境下怎么保证系统安全运转
  2. Linux 的魅力: 开发 Nokia N800
  3. Linux安全设置手册
转载请说明出处
知优网 » Linux下怎么完成不同网段之间的拜访(linux如何实现不同网段相互访问)

发表评论

您需要后才能发表评论