ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux 添加静态路由

linux 添加静态路由

原创 Linux操作系统 作者:michaelyf1 时间:2013-07-05 13:14:19 0 删除 编辑
To set static routes, use the /etc/sysconfig/network-scripts/route- files which are read during the network service initialization. For example to add static route for eth0, create a file /etc/sysconfig/network-scripts/route-eth0 and add the routes as explained below
  • For ip commands, the ifup-route script. supplies ip route add and the contents of the file are all parameters necessary to set up the route. For example, to set up a default route, the file would contain the following:
default via X.X.X.X dev eth0
10.10.10.0/24 via X.X.X.X dev eth0
  • The alternative format is as follows:
    ~~~
    ADDRESS0=10.10.10.0
    NETMASK0=255.255.255.0
    GATEWAY0=X.X.X.X

  • In the above example, X.X.X.X is the gateway IP address. Subsequent entries must be numbered sequentially (for example ADDRESS1=, NETMASK1=, GATEWAY1=). Note, that multiple entries must be sequentially numbered and must not skip a value (0 must be followed by 1, not a number greater than 1).

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

下一篇: linux 空间管理
请登录后发表评论 登录
全部评论

注册时间:2008-10-09

  • 博文量
    40
  • 访问量
    59522