posts - 63, comments - 37, trackbacks - 0, articles - 0
  IT博客 :: 首页 :: 新随笔 :: 联系 ::  :: 管理

Linux 中有关路由方面的一些命令

Posted on 2006-07-02 21:08 Enjoy Life 阅读(572) 评论(0)  编辑 收藏 引用 所属分类: 交换与路由
Linux 中有关路由方面的一些命令
显示地址:
ip address show
ifconfig

显示路由:
ip route show
route -n

查看ARP缓存表:
ip neigh show
删除ARP缓存表:
ip neigh delete 9.3.76.43 dev eth0

IPv4隧道的配置(IP-IN-IP隧道)
A-10.0.1.0/24     }-172.19.20.21(中间网络)172.16.17.18--{10.0.2.0/24-B
A上做如下配置:
ifconfig tunl0 10.0.1.1 pointopoint 172.19.20.21
route add -net 10.0.2.0 netmask 255.255.255.0 dev tunl0
B上做如下配置:
ifconfig tunl0 10.0.2.1 pointopoint 172.16.17.18
route add -net 10.0.1.0 netmask 255.255.255.0 dev tunl0
中止隧道
ifconfig tunl0 down

IPv6隧道的配置:
我们假设你有如下的IPv6网络,你想把它连接到6bone或者一个朋友那里。
Network 3ffe:406:5:1:5:a:2:1/96
你的IPv4地址是172.16.17.18,6bone 路由器的IPv4地址是172.22.23.24。
ip tunnel add sixbone mode sit remote 172.22.23.24 local 172.16.17.18 ttl 255
ip link set sixbone up
ip addr add 3ffe:406:5:1:5:a:2:1/96 dev sixbone
ip route add 3ffe::/15 dev sixbone
让我们来讨论一下。我们创建了一个叫做sixbone的隧道设备。我们设置它的模式是sit(也就是在IPv4隧道中使用IPv6)并且告诉它对端(remote)和本端 (local)在哪里。TTL设置为最大,255。接着,我们激活了这个设备(up)。然后,我们添加了我们自己的网络地址,并添加了一条通过隧道去往3ffe::/15 (现在全部属于6bone)的路由。
GRE隧道是现在最受欢迎的隧道技术。它也广泛地应用于Linux世界之外并成为一个标准,是个好东西。
只有注册用户登录后才能发表评论。