如何使用虚拟网卡添加路由?=resolved
本帖最后由 alan0203 于 2010-08-22 10:20 编辑
有一台solaris 10 Sparc,路由表中将组播路由绑定到了一块虚拟网卡(e1000g0:1)上。我在另外一台相同配置的机子上想要做同样的配置。试过下面的命令,可以将路由绑定到物理网卡(e1000g0)上,但是无法到虚拟网卡上。请高手指点这个路由是如何设定的。谢谢!
route add -net 224.0.0.0 -netmask 240.0.0.0 10.15.44.227 -ifp e1000g0:1 (结果是绑定到e1000g0上)
下面是已经设定好的机子上的路由表:
$ netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default 10.15.44.1 UG 1 191974
10.15.44.0 10.15.44.227 U 1 762935 e1000g0:1
10.15.44.0 10.15.44.207 U 1 0 e1000g0
10.15.44.0 10.15.44.207 U 1 619630 e1000g3
224.0.0.0 10.15.44.227 U 1 0 e1000g0:1 ### (我想要做同样的设置)
127.0.0.1 127.0.0.1 UH 6 331210 lo0
网卡的配置:
$ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=209040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,CoS> mtu 1500 index 2
inet 10.15.44.206 netmask ffffff00 broadcast 10.15.44.255
groupname net1
e1000g0:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
inet 10.15.44.227 netmask ffffff00 broadcast 10.15.44.255
e1000g3: flags=209040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,CoS> mtu 1500 index 3
inet 10.15.44.207 netmask ffffff00 broadcast 10.15.44.255
groupname net1
$ route -p show
No persistent routes are defined
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
谢谢~高手啊..自娱自乐型~
组播绑给e1000g0:1有什么作用
需要补充网络知识。
收藏了,很实用的。
恭喜
问题已解决。 "route -p -n add -interface 224.0/4 -gateway [virtual_nic_ip]" 命令可以添加相应的路由. FYI.
here is on a test machine:
bash-3.00# netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
10.181.8.0 10.181.8.161 U 1 1027 e1000g0
10.181.8.0 10.181.8.172 U 1 0 e1000g0:1
127.0.0.1 127.0.0.1 UH 3 56 lo0
bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv 4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 10.181.8.161 netmask ffffff00 broadcast 10.181.8.255
ether 0:c:29:f9:c3:d
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 10.181.8.172 netmask ffffff00 broadcast 10.181.8.255
--------------------------------------------------------------------------
bash-3.00# route -n add -interface 224.0/4 -gateway 10.181.8.172
add net 224.0/4: gateway 10.181.8.172
--------------------------------------------------------------------------
bash-3.00# netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
10.181.8.0 10.181.8.161 U 1 1034 e1000g0
10.181.8.0 10.181.8.172 U 1 0 e1000g0:1
224.0.0.0 10.181.8.172 U 1 0 e1000g0:1
127.0.0.1 127.0.0.1 UH 3 56 lo0
bash-3.00#