ubuntu网络配置

临时配置ip

ifconfig eth0  192.168.1.10 netmask 255.0.0.0   

静态配置ip

ubuntu的网络配置信息放在 /etc/network/interfaces 中,
如果配置动态获取ip,则在上述文件中加入以下内容:
auto eth0
iface eth0 inet dhcp
如果配置静态ip,则添加如下内容:
auto eth0
iface eth0 inet static
address 192.168.33.201
netmask 255.255.255.0
gateway 192.168.33.1
要是配置生效,需要重启网卡:
ifconfig eth0 down
ifconfig eth0 up
不是root,命令前面加sudo
接着用ifconfig命令查看ip是否配置成功。
若还有没有配置成功,则需重启下网络服务
/etc/init.d/networking restart


临时配置dns

route add default gw 10.2.2.1 dev eth0

静态配置dns

ubuntu 的dns服务器信息,放在 /etc/resolv.conf中,
添加dns服务器地址,如202.112.125.53,则在上述文件中加入
nameserver  202.112.125.53

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值