您的位置:首页 > 理论基础 > 计算机网络

linux 网络设置

2016-04-28 15:40 435 查看

临时设置

1. ip地址

sudo ifconfig eth0 192.168.1.xxx netmask 255.255.255.0 up


现在可以ping通内网地址

2.路由

sudo route add default gw 192.168.1.1


现在可以ping通外网地址

3.dns

修改文件

/etc/resolv.conf


增加

nameserver 114.114.114.114


现在可以ping通域名

永久设置

不带桌面ubuntu在文件
/etc/network/interfaces
中设置

然后:

service networking restart


或者:

ifconfig eth0 down
ifconfig eth0 up


或者:

ifdown eth0
ifup eth0


其他

host文件位置

/etc/hosts


参考:

1.http://www.cnblogs.com/bo083/archive/2012/11/23/2785172.html

2.http://www.2cto.com/os/201109/104152.html

3.http://zhidao.baidu.com/link?url=-dKd8SuAu8pjWX-wZCgEYO6EbYXuft-ovx6rO5hZQJOaBXG8jdCfeVWbuefQE9jI3z4dCWuKW74tg-pVliBRUq
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: