Ubuntu 网络配置
2012-07-13 12:35
459 查看
1. 网络配置文件:/etc/network/interfaces
如果通过DHCP来获取IP地址的,默认interfaces文件看起来是:
auto lo
iface lo inet loopback
如果要手工指定IP地址,则要把DHCP关键字改为scatic:
auto lo
iface lo inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
配置好后,重启服务:
sudo /etc/init.d/networking restart
2. 域名服务器配置文件:/etc/resolv.conf
默认配置看上去是:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
如果有要修改DNS服务器地址,则可以把上面的IP地址替换掉
3. /etc/hosts 文件
默认看上去像:
127.0.0.1 localhost
127.0.1.1 jeff-F6Ve
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
默认情况下,进行域名解析时,系统会先查找/etc/hosts文件,再去查询DNS服务器,如果想更改这个顺序,可以修改/etc/nsswitch.conf 文件中 hosts一行的顺序。
如果通过DHCP来获取IP地址的,默认interfaces文件看起来是:
auto lo
iface lo inet loopback
如果要手工指定IP地址,则要把DHCP关键字改为scatic:
auto lo
iface lo inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
配置好后,重启服务:
sudo /etc/init.d/networking restart
2. 域名服务器配置文件:/etc/resolv.conf
默认配置看上去是:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
如果有要修改DNS服务器地址,则可以把上面的IP地址替换掉
3. /etc/hosts 文件
默认看上去像:
127.0.0.1 localhost
127.0.1.1 jeff-F6Ve
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
默认情况下,进行域名解析时,系统会先查找/etc/hosts文件,再去查询DNS服务器,如果想更改这个顺序,可以修改/etc/nsswitch.conf 文件中 hosts一行的顺序。
相关文章推荐
- Ubuntu安装配置Charles,抓取http网络请求包
- Ubuntu10.10网络配置
- Ubuntu网络接口配置文件:nano/etc/network/interfaces 以及 Ifconfig只显示一个lo
- Ubuntu在corporate network下的网络配置问题
- ubuntu下进行网络配置
- Ubuntu设置Static IP的方法Ifconfig网络配置工具详解
- Ubuntu10.10的网络配置
- ubuntu 网络文件系统(NFS) 安装 配置
- ubuntu下 virtualbox 网络配置,xp共享上网
- 在VirtualBox中安装Ubuntu 8.04 Server(3,配置本机网络)
- ubuntu 网络配置
- ubuntu做主机VirtualBox网络桥接的配置
- Ubuntu网络配置
- Ubuntu16.04静态网络配置
- VM Ubuntu网络配置
- ubuntu 网络配置
- Ubuntu通过修改配置文件进行网络配置
- ubuntu 配置ntop 监控本地网络
- [转]Ubuntu10.04的网络配置