Chinaunix首页 | 论坛 | 博客
  • 博客访问: 126682
  • 博文数量: 43
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-26 11:46
文章分类

全部博文(43)

文章存档

2017年(1)

2016年(16)

2015年(18)

2014年(8)

我的朋友

分类: LINUX

2015-09-10 16:33:48

$ sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0

iface eth0 inet static #ip
address 172.16.39.111
netmask 255.255.254.0
gateway 172.16.38.1

auto br100
iface br100 inet static #桥接 一般不用
bridge_ports eth1
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address 192.168.0.1
netmask 255.255.0.0
broadcast 192.168.255.255

------------------------------------------------------------

1、设置IP地址、网关
nano /etc/network/interfaces /etc/network/interfacesbak #备份原有配置文件
nano /etc/network/interfaces #编辑网网卡配置文件
auto lo
iface lo inet loopback
auto eth0 #开机自动连接网络
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.21.168 #设置ip地址
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.21.2 #设置网关
ctrl+o #保存配置
ctrl+x #退出
2、设置dns
cp /etc/resolv.conf /etc/resolv.confbak #备份原有dns配置文件
nano /etc/resolv.conf #编辑配置文件,添加以下内容
nameserver 8.8.8.8 #设置首选dns
nameserver 8.8.4.4 #设置备用dns
ctrl+o #保存配置
ctrl+x #退出
系统运维 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接
3、重启网络
/etc/init.d/networking restart #重启网络

至此,IP地址、网关、DNS配置完成,现在系统已经可以上网了。


阅读(1502) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~