博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何設定static route
阅读量:4285 次
发布时间:2019-05-27

本文共 2767 字,大约阅读时间需要 9 分钟。

88.9.10.128是一個host

指定要連結到88.9.10.128這台主機的封包,會經由wlan0的192.168.11.1這個gateway出去

Flags的H待表示一個Host

route add 88.9.10.128 gw 192.168.11.1 dev wlan0
# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan00.0.0.0         192.192.192.1   0.0.0.0         UG    0      0        0 eth088.9.10.128     192.168.11.1    255.255.255.255 UGH   0      0        0 wlan0192.168.11.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0192.192.192.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

設定static route

連結到172.100.100.0網段的封包,必須經過192.192.192.1這個gw(當沒有指定是經由那個界面出去時,會經由gw去判斷,應該是那個interface出去)

route add -net 172.100.100.0 netmask 255.255.255.0  gw 192.192.192.1

連結到172.101.101.0網段的封包,必須經過192.192.192.1這個gw,並且明定指出是經由eth0這個界面出去

route add -net 172.101.101.0 netmask 255.255.255.0  gw 192.192.192.1 dev eth0
# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan00.0.0.0         192.192.192.1   0.0.0.0         UG    0      0        0 eth088.9.10.128     192.168.11.1    255.255.255.255 UGH   0      0        0 wlan0172.100.100.0   192.192.192.1   255.255.255.0   UG    0      0        0 eth0172.101.101.0   192.192.192.1   255.255.255.0   UG    0      0        0 eth0192.168.11.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0192.192.192.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

刪除一條route 規則

route del -net 172.100.100.0 netmask 255.255.255.0 dev eth0
# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan00.0.0.0         192.192.192.1   0.0.0.0         UG    0      0        0 eth088.9.10.128     192.168.11.1    255.255.255.255 UGH   0      0        0 wlan0172.101.101.0   192.192.192.1   255.255.255.0   UG    0      0        0 eth0192.168.11.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0192.192.192.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

刪除UGH的route 規則

route del 88.9.10.128
# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan00.0.0.0         192.192.192.1   0.0.0.0         UG    0      0        0 eth0172.101.101.0   192.192.192.1   255.255.255.0   UG    0      0        0 eth0192.168.11.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0192.192.192.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

 

转载地址:http://zzpgi.baihongyu.com/

你可能感兴趣的文章
matlab错误:Subscript indices must either be real positive integers or logicals.
查看>>
行列式及其性质
查看>>
matlab 保留固定长度的整数位
查看>>
xshell-常用命令
查看>>
用xshell运行matlab 远程给Linux服务器安装Matlab R2014b
查看>>
在本地电脑使用远程服务器的图形界面——包括 MATLAB、PyCharm 等各种软件
查看>>
向量转置怎么求导(多元线性回归原理推导用)
查看>>
Matlab中布尔值/逻辑值与数值型类型的相互转换
查看>>
Matlab 并行代码
查看>>
matlab中的并行方法与理解(2):parfor中的变量类型
查看>>
CentOS 7 命令行模式安装teamviewer13
查看>>
teamviewer Linux centos7安装使用详细
查看>>
【MATLAB】线条标记符大小设置
查看>>
MATLAB中矩阵的逻辑索引方法
查看>>
windows下go dep环境搭建
查看>>
EMQX docker安装及运行
查看>>
使用python和MQTT.fx连接mqtt
查看>>
EMQTT的ACL鉴权(topic权限控制)
查看>>
emqx客户端用户名密码登录验证配置
查看>>
python多线程之信号量semaphore实战
查看>>