linux路由route配置
来源:互联网 发布:prisma 算法 sdk 编辑:程序博客网 时间:2024/04/25 07:22
使用双网卡,同时使用2个网关的时候就需要加一条静态路由了。当然还有很多时候会需要加路由。
一:使用 route 命令添加
使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:
//添加到主机的路由
# route add –host 192.168.1.11 dev eth0
# route add –host 192.168.1.12 gw 192.168.1.1
//添加到网络的路由
# route add –net 192.168.1.11 netmask 255.255.255.0 eth0
# route add –net 192.168.1.11 netmask 255.255.255.0 gw 192.168.1.1
# route add –net 192.168.1.0/24 eth1
//添加默认网关
# route add default gw 192.168.1.253
//删除路由
# route del –host 192.168.1.11 dev eth0
二:在linux下设置永久路由的方法:
./etc/sysconfig/static-routes :
any net 192.168.3.0/24 gw 192.168.3.254
any net 10.250.228.128 netmask 255.255.255.192 gw 10.250.228.129
使用static-routes的方法是最好的。无论重启系统和service network restart 都会生效
static-routes文件又是什么呢,这个是network脚本执行时调用的一个文件,这个文件的放置在/etc/sysconfig目录下,在network脚本中的位置是:
# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
/sbin/route add -$args
done
fi
从这段脚本可以看到,这个就是添加静态路由的方法,static-routes的写法是
any net 192.168.0.0/16 gw 网关ip
- linux路由route配置
- linux 路由配置——route命令
- linux路由配置命令route学习
- linux 路由 route命令
- linux 路由route
- linux route路由
- linux路由route 命令
- linux 使用 ip route , ip rule , iptables 配置策略路由
- Linux 路由配置 route命令 /etc/sysconfig/static-routes
- Linux 使用 ip route , ip rule , iptables 配置策略路由
- Linux route添加静态路由
- Linux Route 路由详细解释
- linux系统修改route路由
- route 路由配置 命令
- ZF2多级树形路由Route配置实例
- ZF2多级树形路由Route配置实例
- NG之Route模块路由配置
- angularjs路由配置$route以及案例展示
- 尺度不变特征变换匹配算法详解
- 2015第一天
- 多个Activity在同一个页面播放
- android开发之如何知晓App是否已签名
- linux 文件长度 文件截断 rename renameat
- linux路由route配置
- OPC工作记录整理——第一篇(序)
- 9.Java NIO系列教程之SocketChannel
- android 消费者和生产者的队列处理模型
- c++_primer_exercise_1339
- PHPWAMP 修改 mysql root 密码
- 解决android sdk国内更新问题
- Java压缩技术(四) GZIP——Java原生实现
- 9.拷贝