linux 设置IP DNS 网关
2016-05-13 16:06
447 查看
一, 一次修改,重启后失败
设置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
设置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
相关文章推荐
- CentOS tar加解压文件
- 初识Linux
- CentOS 安装 JDK
- cobbler 远程安装带图像化的centos服务器 kickstart文件
- centos 下运行程序出现error while loading shared libraries cannot open shared object file错误
- Linux查看进程运行的完整路径
- 珠海全志公司的 Linux 内核遗留了后门
- linux下实现桥接联网
- linux gcc 4.8.5 升级编译
- Centos6 内核开发环境搭建
- caffe安装(Linux)
- linux系统mysql删除一行报错:Cannot delete or update a parent row: a foreign key constraint fails
- CentOS 7下源码安装MySQL 5.7
- linux系统的目录结构
- linux下解压命令大全
- CentOS 源码安装 MySql
- linux下svn服务器搭建步骤
- linux的命令使用记录
- linux 内存管理之拷贝文件
- 添加环境变量