ubuntu网络配置及文件
来源:互联网 发布:pkpm软件多少钱 编辑:程序博客网 时间:2024/06/10 09:56
Ubuntu 的网络配置文件主要有以下几个:IP地址配置文件、主机名称配置文件、DNS配置文件。
IP地址配置文件: /etc/network/interfaces
打开后里面可设置DHCP或手动设置静态ip。前面auto eth0,让网卡开机自动挂载.
1. 以DHCP方式配置网卡
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
也可以在命令行下直接输入下面的命令来获取地址
sudo dhclient eth0
2. 为网卡配置静态IP地址
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
主机名称配置文件(/bin/hostname)
使用下面的命令来查看当前主机的主机名称:
sudo /bin/hostname
使用下面的命令来设置当前主机的主机名称:
sudo /bin/hostname newname
系统启动时,它会从/etc/hostname来读取主机的名称.
DNS配置文件
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.
要访问DNS 服务器来进行查询,需要设置/etc/resolvconf/resolv.conf.d/head文件,网上有很多帖子说是修改 /etc/resolv.conf 文件,在ubuntu14.04版本中,/etc/resolv.conf 只是个link而已,真实的文件是/etc/resolvconf/resolv.conf.d/head
sudo vi/etc/resolvconf/resolv.conf.d/head
nameserver 202.96.128.68
nameserver 61.144.56.101
nameserver 192.168.8.220
/重新设置网络,以启用新设置
IP地址配置文件: /etc/network/interfaces
打开后里面可设置DHCP或手动设置静态ip。前面auto eth0,让网卡开机自动挂载.
1. 以DHCP方式配置网卡
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
也可以在命令行下直接输入下面的命令来获取地址
sudo dhclient eth0
2. 为网卡配置静态IP地址
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
dns-servernames 192.168.1.1 192.168.2.1 (DNS设置,下面还有另一种方法在resoleconf文件中配置,但是此处的优先级更高,修改更方便,推荐!)
将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
主机名称配置文件(/bin/hostname)
使用下面的命令来查看当前主机的主机名称:
sudo /bin/hostname
使用下面的命令来设置当前主机的主机名称:
sudo /bin/hostname newname
系统启动时,它会从/etc/hostname来读取主机的名称.
DNS配置文件
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.
要访问DNS 服务器来进行查询,需要设置/etc/resolvconf/resolv.conf.d/head文件,网上有很多帖子说是修改 /etc/resolv.conf 文件,在ubuntu14.04版本中,/etc/resolv.conf 只是个link而已,真实的文件是/etc/resolvconf/resolv.conf.d/head
sudo vi/etc/resolvconf/resolv.conf.d/head
nameserver 202.96.128.68
nameserver 61.144.56.101
nameserver 192.168.8.220
/重新设置网络,以启用新设置
sudo /etc/init.d/networking restart
转:http://blog.163.com/yi_yixinyiyi/blog/static/136286889201122221528757/
0 0
- ubuntu网络配置及文件
- 网络配置及文件服务
- ubuntu下ip资源及网络配置
- Ubuntu 常见网络问题及配置
- ubuntu系统初始化网络及mysql配置
- ubuntu服务器安装及网络配置
- Ubuntu配置网络文件共享服务器NFS
- ubuntu下TFTP服务器及NFS网络配置详细过程
- Ubuntu下网络设置及静态DNS配置
- ubuntu安装及网络配置和软件安装方法
- 14、oracle vm virtualbox & ubuntu-14.04网络及性能配置
- ubuntu 下网络环境配置及互ping通过
- Ubuntu中NFS服务及网络文件挂载
- ubuntu 网络配置
- ubuntu 网络配置
- Ubuntu配置网络
- Ubuntu简单网络配置
- ubuntu linux网络配置
- 正态分布的前世今生(上)
- C++作业7
- 正态分布的前世今生(下)
- C++第7次上机实验:素数和回文
- Linux下进度条小程序
- ubuntu网络配置及文件
- 服务不能启用的原因总结
- struts2框架搭建
- Meeting Rooms
- 编程中数据隐藏(一)
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginAction‘
- unity3d学习中的一些问题
- leetcode-Intersection of Two Linked Lists-160
- 欢迎使用CSDN-markdown编辑器