linux路由跟cisco路由器的一点出入
作者:happyboy 日期:2009-08-19
之前配linux的路由都是用的默认掩码,也没有遇到什么问题,今天做时遇到其用到了一个小问题,在网络中,由于做网络互联,只考虑采用两个IP,掩码为30bit的很常见,但是错误如下
[root@happyboy ~]# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:0C:29:41:E0:69
inet addr:10.10.10.6 Bcast:10.10.10.7 Mask:255.255.255.252
inet6 addr: fe80::20c:29ff:fe41:e069/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:212 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26964 (26.3 KiB) TX bytes:9296 (9.0 KiB)
Interrupt:193 Base address:0x2080
[root@happyboy ~]# route add -net 10.10.10.1 netmask 255.255.255.252 dev eth1
route: netmask doesn't match route address
Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables
route [-v] [-FC] {add|del|flush} ... Modify routing table for AF.
route {-h|--help} [<AF>] Detailed usage syntax for specified AF.
route {-V|--version} Display version/author and exit.
-v, --verbose be verbose
-n, --numeric don't resolve names
-e, --extend display other/more information
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
<AF>=Use '-A <af>' or '--<af>'; default: inet
List of possible address families (which support routing):
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
x25 (CCITT X.25)
[root@happyboy ~]# route add -net 10.10.10.0 netmask 255.255.255.252 gw 10.10.10.5
[root@happyboy ~]# route add -net 172.17.1.0 netmask 255.255.255.0 gw 10.10.10.5
就是说前面的-net一定要写上网络号,而不是象在cisco设备上一样,只需要输入这个网络中的任何一个地址,掩码会自动将其掩去,实际使用中的一点差异.这些差异不仅仅体现在普通linux发行版本上,也体现在不同厂商的交换机之间,比如cisco交换机某端口绑定的IP,如果直接在端口模式输入no ip address后不加任何参数会删除所有绑定的IP,但是DELL 6224很奇怪,会提示错误无法删除,不管绑定了几个IP,比如输入完整的 no ip address x.x.x.x x.x.x.x的方式.这些只能在使用中慢慢积累了~~~
[root@happyboy ~]# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:0C:29:41:E0:69
inet addr:10.10.10.6 Bcast:10.10.10.7 Mask:255.255.255.252
inet6 addr: fe80::20c:29ff:fe41:e069/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:212 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26964 (26.3 KiB) TX bytes:9296 (9.0 KiB)
Interrupt:193 Base address:0x2080
[root@happyboy ~]# route add -net 10.10.10.1 netmask 255.255.255.252 dev eth1
route: netmask doesn't match route address
Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables
route [-v] [-FC] {add|del|flush} ... Modify routing table for AF.
route {-h|--help} [<AF>] Detailed usage syntax for specified AF.
route {-V|--version} Display version/author and exit.
-v, --verbose be verbose
-n, --numeric don't resolve names
-e, --extend display other/more information
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
<AF>=Use '-A <af>' or '--<af>'; default: inet
List of possible address families (which support routing):
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
x25 (CCITT X.25)
[root@happyboy ~]# route add -net 10.10.10.0 netmask 255.255.255.252 gw 10.10.10.5
[root@happyboy ~]# route add -net 172.17.1.0 netmask 255.255.255.0 gw 10.10.10.5
就是说前面的-net一定要写上网络号,而不是象在cisco设备上一样,只需要输入这个网络中的任何一个地址,掩码会自动将其掩去,实际使用中的一点差异.这些差异不仅仅体现在普通linux发行版本上,也体现在不同厂商的交换机之间,比如cisco交换机某端口绑定的IP,如果直接在端口模式输入no ip address后不加任何参数会删除所有绑定的IP,但是DELL 6224很奇怪,会提示错误无法删除,不管绑定了几个IP,比如输入完整的 no ip address x.x.x.x x.x.x.x的方式.这些只能在使用中慢慢积累了~~~
评论: 1 | 引用: 0 | 查看次数: 534
回复
]学好了 linux路由跟cisco路由器的一点出入,谢谢。
发表评论
你没有权限发表评论!
上一篇
下一篇


文章来自:
Tags:
相关日志:
