ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux下添加路由的方法

linux下添加路由的方法

原创 Linux操作系统 作者:season0891 时间:2010-10-10 13:57:54 0 删除 编辑
linux下添加路由的方法:  一:使用 route 命令添加  使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:  //添加到主机的路由  # route add –host 192.168.168.110 dev eth0 ...
  linux下添加路由的方法:
  一:使用 route 命令添加
  使用route 命令添加的路由,机器重启或者网卡重启后路由就失效了,方法:
  //添加到主机的路由
  # route add –host 192.168.168.110 dev eth0
  # route add –host 192.168.168.119 gw 192.168.168.1
  //添加到网络的路由
  # route add –net IP netmask MASK eth0
  # route add –net IP netmask MASK gw IP
  # route add –net IP/24 eth1
  //添加默认网关
  # route add default gw IP
  //删除路由
  # route del –host 192.168.168.110 dev eth0
  二:在linux下设置永久路由的方法:
  1.在/etc/rc.local里添加
  方法:
  route add -net 192.168.3.0/24 dev eth0
  route add -net 192.168.2.0/24 gw 192.168.3.254
  2.在/etc/sysconfig/network里添加到末尾
  方法:GATEWAY=gw-ip 或者 GATEWAY=gw-dev
  3./etc/sysconfig/static-router :
  any net x.x.x.x/24 gw y.y.y.y

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/90618/viewspace-675674/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    790
  • 访问量
    2098076