linux添加路由
2012-11-09 15:43
344 查看
1、添加静态路由命令
添加一条到主机192.168.168.110的路由(通过eth0)
添加一条到主机192.168.168.110的路由(通过ip192.168.1.143)
添加到网络的路由(通过eth0)
添加到网络的路由(通过ip192.168.1.1)
Destination表示路由的目标IP地址
Gateway表示网关使用的主机名或者是IP地址。上面输出的"*"表示没有网关
Genmask表示路由的网络掩码
Flags是表示路由的标志。可用的标志及其意义是:U表示路由在启动,H表示target是一台主机,G表示使用网关,R表示对动态路由进行复位设置;D表示动态安装路由,M表示修改路由,!表示拒绝路由。
Metric表示路由的单位开销量
Ref表示依赖本路由现状的其它路由数目
Use表示路由表条目被使用的数目
Iface表示路由所发送的包的目的网络
以上形式添加路由系统重启后会失效,要永久生效的话,编辑/etc/sysconfig/network-scripts/route-eth0文件。
添加一条到主机192.168.168.110的路由(通过eth0)
[root@localhost ~]# route add -host 192.168.1.110 dev eth0 [root@localhost ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.110 * 255.255.255.255 UH 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 1 0 0 eth0 192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
添加一条到主机192.168.168.110的路由(通过ip192.168.1.143)
[root@localhost ~]# route add -host 192.168.168.110 gw 192.168.1.143 [root@localhost ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.110 * 255.255.255.255 UH 0 0 0 eth0 192.168.168.110 192.168.1.143 255.255.255.255 UGH 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 1 0 0 eth0 192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
添加到网络的路由(通过eth0)
[root@localhost ~]# route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 [root@localhost ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.110 * 255.255.255.255 UH 0 0 0 eth0 192.168.168.110 192.168.1.143 255.255.255.255 UGH 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
添加到网络的路由(通过ip192.168.1.1)
[root@localhost ~]# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.1.1 [root@localhost ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.110 * 255.255.255.255 UH 0 0 0 eth0 192.168.168.110 192.168.1.143 255.255.255.255 UGH 0 0 0 eth0 192.168.100.0 192.168.1.1 255.255.255.0 UG 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Destination表示路由的目标IP地址
Gateway表示网关使用的主机名或者是IP地址。上面输出的"*"表示没有网关
Genmask表示路由的网络掩码
Flags是表示路由的标志。可用的标志及其意义是:U表示路由在启动,H表示target是一台主机,G表示使用网关,R表示对动态路由进行复位设置;D表示动态安装路由,M表示修改路由,!表示拒绝路由。
Metric表示路由的单位开销量
Ref表示依赖本路由现状的其它路由数目
Use表示路由表条目被使用的数目
Iface表示路由所发送的包的目的网络
以上形式添加路由系统重启后会失效,要永久生效的话,编辑/etc/sysconfig/network-scripts/route-eth0文件。
[root@localhost ~]# vim /etc/sysconfig/network-scripts/route-eth0 192.168.1.0 via 192.168.1.143
相关文章推荐
- linux 添加路由,让不同网络环境过来的访问按原线路回去
- Linux 路由 学习笔记 之六 策略规则的添加
- linux下如何添加路由
- linux和windows路由条目添加方法。
- linux下添加路由的方法
- Linux如何添加路由
- linux 添加路由的方法
- linux -- 添加、修改、删除路由
- linux下添加路由的方法:
- linux路由添加
- 为linux添加永久路由
- linux下添加新的路由
- linux 添加路由
- Linux添加路由的两种方法
- linux 添加路由
- Linux添加路由的两种方法
- linux使用 netlink 添加路由简单代码
- linux 添加永久路由的几种方法。
- linux服务器添加、删除路由
- Windows/Linux中手动添加路由