linux 设置IP DNS 网关
2016-05-13 16:06
369 查看
一, 一次修改,重启后失败
设置IP
sudo ifconfig eth0 192.168.50.73 netmask 255.255.255.0
设置网关
sudo route add default gw 192.168.50.1
设置DNS
修改/etc/resolv.conf,在其中加入
nameserver DNS的地址1
nameserver DNS的地址2
二,永久修改
直接修改Ubuntu IP系统配置文件
Ubuntu IP的网络配置文件是根目录下:
sudo vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.50.73
gateway 192.168.50.1
netmask 255.255.255.0
重启
sudo /etc/init.d/networking restart
查看 ifconfig 阅读更多
设置IP
sudo ifconfig eth0 192.168.50.73 netmask 255.255.255.0
设置网关
sudo route add default gw 192.168.50.1
设置DNS
修改/etc/resolv.conf,在其中加入
nameserver DNS的地址1
nameserver DNS的地址2
二,永久修改
直接修改Ubuntu IP系统配置文件
Ubuntu IP的网络配置文件是根目录下:
sudo vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.50.73
gateway 192.168.50.1
netmask 255.255.255.0
重启
sudo /etc/init.d/networking restart
配置DNS
方法一、修改/etc/network/interfaces
dns-nameservers 8.8.8.8
方法二、修改/etc/resolvconf/resolv.conf.d/base文件,该文件默认是空的,在里面写入:
nameserver 8.8.8.8
修改完之后保存,然后执行resolvconf -u
重启电脑
reboot查看 ifconfig 阅读更多
相关文章推荐
- Linux下命令行设置IP、网关和DNS
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- 转 -- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- 在Linux操作系统下用命令方式修改IP、网关和dns设置
- Linux 下设置IP、网关、DNS
- linux设置IP,网关,DNS和MAC地址
- Linux下命令行设置IP、网关和DNS
- Linux下命令行设置IP,网关及DNS
- Linux系列:Fedora虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Linux系列:Fedora虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- linux使用命令设置IP,DNS,网关
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Linux系统中设置ip ,网关 与 DNS
- SUSE Linux Enterprise Server (suse 11 sp2)设置IP、网关、DNS
- Linux系列:Fedora虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)(转载)
- linux 设置IP DNS 网关
- Linux下命令行设置IP,网关,DNS