Linux网络配置

来源:互联网 发布:软件测试管理体系 编辑:程序博客网 时间:2024/05/16 14:51

1、用vi 打开/etc/network/interfaces

auto lo

iface lo inet loopback


auto eth0  (自动识别启动以太网)

iface eth0 inet static (固定IP地址,static改成dhcp并注释下面三行自动获取IP)

address xxx.xxx.xxx.xxx (虚拟机IP地址)

gateway xxx.xxx.xxx.xxx (网关)

netmask xxx.xxx.xxx.xxx (子网掩码,C类为255.255.255.0,B类为255.255.0.0)


2、用vi打开/etc/resolv.conf在末尾添加

nameserver 202.96.134.133


3、配置网关

sudo route add default gw xxx.xxx.xxx.xxx


4、重新加载网络

sudo /etc/init.d/networking force-reload

sudo /etc/init.d/networking restart


5、还不行就重启系统





0 0
原创粉丝点击