免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: heathcup
打印 上一主题 下一主题

请教:路由表存在于哪个文件当中? [复制链接]

论坛徽章:
0
11 [报告]
发表于 2005-09-01 14:39 |只看该作者

请教:路由表存在于哪个文件当中?

[quote]原帖由 "heathcup"]我们在更改静态路由的时候,直接在终端输入:route add,route del之类的就行了,请问这样的操作它是改变了系统的哪些配置,具体来说,它和哪些文件有关呢?继续知道,谢谢!![/quote 发表:


#cat /etc/sysconfig/network-scripts/route-eth0

or

#cat /etc/sysconfig/network-scripts/eth0.route  

GATEWAY0=192.168.55.1
NETMASK0=255.255.0.0
ADDRESS0=10.1.0.0


Very strange format, I'd rather to write it to  rc.local

论坛徽章:
0
12 [报告]
发表于 2005-09-01 15:27 |只看该作者

请教:路由表存在于哪个文件当中?

我在/etc/init.d/network中看到一下内容:

        # Add non interface-specific static-routes.
        if [ -f /etc/sysconfig/static-routes ]; then
           grep "^any" /etc/sysconfig/static-routes | while read ignore args ; d
o
              /sbin/route add -$args
           done
        fi

然后就查看/etc/sysconfig/static-routes 的内容,后来发现没有;
就自己建了一个,但是route add了一下,这个文件还是空的,晕!

论坛徽章:
0
13 [报告]
发表于 2005-09-01 15:34 |只看该作者

请教:路由表存在于哪个文件当中?

原帖由 "fargo" 发表:


#cat /etc/sysconfig/network-scripts/route-eth0

or

#cat /etc/sysconfig/network-scripts/eth0.route  

GATEWAY0=192.168.55.1
NETMASK0=255.255.0.0
ADDRESS0=10.1.0.0


Very strange format..........


这个……没找着呢……
[root@localhost sysconfig]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls
ifcfg-eth0      ifdown-isdn   ifup-ippp   ifup-routes
ifcfg-eth1      ifdown-post   ifup-ipv6   ifup-sit
ifcfg-lo        ifdown-ppp    ifup-ipx    ifup-sl
ifdown          ifdown-sit    ifup-isdn   ifup-wireless
ifdown-aliases  ifdown-sl     ifup-plip   init.ipv6-global
ifdown-cipcb    ifup          ifup-plusb  network-functions
ifdown-ippp     ifup-aliases  ifup-post   network-functions-ipv6
ifdown-ipv6     ifup-cipcb    ifup-ppp

论坛徽章:
0
14 [报告]
发表于 2005-09-01 15:37 |只看该作者

请教:路由表存在于哪个文件当中?

原帖由 "heathcup"]alhost network-scripts 发表:
# ls
ifcfg-eth0      ifdown-isdn   ifup-ippp   ifup-routes
ifcfg-eth1      ifdown-post   ifup-ipv6   ifup-sit
ifcfg-lo        ifdown-ppp    ifup-ipx    ifup-sl
ifdown       ..........


create one by youself.

论坛徽章:
0
15 [报告]
发表于 2005-09-01 15:49 |只看该作者

请教:路由表存在于哪个文件当中?

原帖由 "fargo" 发表:


create one by youself.


你是说:我创建一个后,再route add的时候,这个文件里面就会记录下来了吗?

不好意思,偶比较菜……

论坛徽章:
0
16 [报告]
发表于 2005-09-01 15:56 |只看该作者

请教:路由表存在于哪个文件当中?

原帖由 "heathcup" 发表:


你是说:我创建一个后,再route add的时候,这个文件里面就会记录下来了吗?

不好意思,偶比较菜……


1) vi the file. it equals route add -net 10.1.0.0/24 -gw 192.168.55.1

# vi  /etc/sysconfig/network-scripts/route-eth0

GATEWAY0=192.168.55.1
NETMASK0=255.255.0.0
ADDRESS0=10.1.0.0


2) change file mode
#chmod 751 /etc/sysconfig/network-scripts/route-eth0
3)reboot or restart network  
#service network restart

论坛徽章:
0
17 [报告]
发表于 2005-09-01 16:35 |只看该作者

请教:路由表存在于哪个文件当中?

I see,thanks.

But I think you misunderstood what I mean.
I just want to know the way to find the system's static route table by using programme,so I think I must check out where the config file is , and then to get it .

If the config file doesn't exit in the system, I need to create one by myself. When  the route table changes the file chaged either, Do you think your way works?

Thanks again!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP