Chinaunix首页 | 论坛 | 博客
  • 博客访问: 271511
  • 博文数量: 42
  • 博客积分: 485
  • 博客等级: 下士
  • 技术积分: 482
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-26 19:33
文章分类
文章存档

2017年(1)

2016年(4)

2015年(8)

2014年(3)

2013年(4)

2012年(3)

2011年(19)

我的朋友

分类: LINUX

2011-05-31 16:52:25


/etc/rc.conf
注:具体的,找到这个文件就知道了,这个文件被rcS在启动时load

################################
# ipconfig fxp0 192.168.8.33/24     # 添加网卡ip
# route add default 192.168.8.1     # 添加路由(也可理解为网关)立即生效,但是重启后失效。
如何重启后仍然保持呢?
代码:# ee /etc/rc.conf
ifconfig_fxp0="inet 192.168.8.8 netmask 255.255.255.0 "  # fxp0 网卡地址和子网掩码
defaultrouter="192.168.8.10"     # 网关地址
hostname="study.nowire.com.cn"     # 机器名
ifconfig_wi0="inet 192.168.8.55  netmask 255.255.255.0"  # wi0 网卡地址,对应无线网卡修改 /etc/rc.conf 配置之后可以通过如下方式生效:
第一种方法:# sh /etc/rc
第二种方法:# /etc/netstart
第三种方法:重启机器
代码:#####
# DHCP 方式
################################
在 /etc/rc.conf 中添加:
ifconfig_fxp0="DHCP" .
需要根据具体情况指定网卡名称。
修改 /etc/rc.conf 配置之后可以通过如下方式生效:
第一种方法:# sh /etc/rc
第二种方法:# /etc/netstart
第三种方法:重启机器
#####
# 关于 DNS 地址的配置
################################
# ee /etc/resolv.conf
nameserver 202.96.209.133
nameserver 202.96.209.5
#####
# 控制网卡的开关
################################
ifconfig fxp0 up
ifconfig fxp0 down
#####
# 路由方面的配置
################################查看路由
代码:netstat -rn添加路由(相当于配置gateway)
代码:route add default 192.168.8.1      # 192.168.8.1为网关地址如果要修改当前路由配置,需要先删除,再新增一条,当然如果不是同名的,如不是default的可以直接添加
代码:route delete default 192.168.8.1
route add default 192.168.8.10
#####
# DHCP release
################################
# dhclient -r    Release the current lease and exit the client. 版权申明:本站文章均来自网络,如有侵权,请联系028-86262244-215,我们收到后立即删除,谢谢!
Here's a clip of dhclient from the FreeBSD man pages;
"The client normally doesn't release the current lease as it is not required by the DHCP protocol. Some cable ISPs require their clients to notify the server if they wish to release an assigned IP address. The -r flag explicitly releases the current lease, and once the lease has been released, the client exits."
If you are getting kill: xxxx: No such process This means the dhclient process was already stopped
#####
# 指定 interface 通过 dhcp 获取 IP
################################
# dhclient xl0    Starts the dhclient process for interface xl0
I think its a good idea to specify an interface Otherwise you may notice your /var/log/messages filling up with "dhclient: send_packet: Address family not supported by protocol family"
Here's a clip of dhclient from the FreeBSD man pages;
"If no interface names are specified on the command line dhclient will normally identify all network interfaces, elimininating non-broadcast interfaces if possible, and attempt to configure each interface."
阅读(1470) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~