现在的位置: 首页 > 综合 > 正文

/etc/network/interfaces

2018年03月30日 ⁄ 综合 ⁄ 共 959字 ⁄ 字号 评论关闭

1 由dhcp服务器分配动态ip的设置

auto eth0 

iface eth0 inet dhcp

auto wlan0http://write.blog.csdn.net/postedit/40002159

iface wlan0 inet dhcp

wpa-conf /etc/wpa_supplicant.conf

2 设置静态ip

auto eth0

iface eth0 inet static

address 192.168.1.102

netmask 255.255.255.0

gateway 192.168.1.1

auto wlan0

iface wlan0 inet static
address 192.168.1.103
netmask 255.255.255.0
gateway 192.168.1.1
pre-up ip link set wlan0 up #你无线网卡的名字 可能不是wlan0请用ifconfig -a查看
pre-up iwconfig wlan0 essid ssid #ssid 为你无线网的名字
wpa-ssid ssid #ssid 为你无线网的名字,同上
wap-psk password #password你无线网的密码 比如12345678

3 启动项 /etc/init.d/networking

重启 sudu /etc/init.d/networking restart

4 说明

auto eth0 表示在启动时自动配置网卡接口eth0

iface 语句只是ifup使用DHCP或静态ip来配置接口ip地址

5 注意(配置eth0且DHCP分配ip情况)

这个配置文件会在系统启动的时候激活你的RJ45网卡接口并尝试通过DHCP服务配置它。如果你并没有插入网线,这将会阻塞系统启动一分钟,等待DHCP超时事件发生后系统才会继续启动。如过你十分确定不需要有线网络,请通过删除或注释/etc/network/interfaces中的auto eth0以禁止这个特性,这将会大大减少系统启动时间。你仍然可以通过手工激活并配置有线网络ifup eth0

6 参考

https://github.com/cubieplayer/Cubian/wiki/%E4%B8%8A%E6%89%8BCubian

http://www.debian.org/doc/manuals/debian-reference/ch05.en.html

抱歉!评论已关闭.