Ubuntu - 修改网络配置
来源:互联网 发布:极光推送 java demo 编辑:程序博客网 时间:2024/04/29 21:59
(1) 修改静态 IP 地址
默认情况下,Ubuntu 是自动获取 IP 地址的。我们可以通过修改 "/etc/network/interfaces" 来达到目的。
~$ sudo cat /etc/network/interfaces[sudo]
password for yuhen:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interfaceauto loiface lo inet loopback
# The primary network interfaceauto eth0iface eth0 inet dhcp 将 eth0 修改成静态配置。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto loiface lo inet loopback
# The primary network interface
auto eth0iface eth0 inet
staticaddress 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
(2) 修改 DNS 配置。
这回的配置文件是 /etc/resolv.conf。
~$ sudo cat /etc/resolv.conf
domain localdomain
search localdomain
nameserver 192.168.0.1
nameserver 202.96.64.68
nameserver 就是我们要修改的 DNS Server 地址。
(2) 最后别忘了重启网络服务。
~$ sudo /etc/init.d/networking restart * Reconfiguring network interfaces... [ OK ]
可以用 ifconfig 和 nslookup 查看 IP、DNS 设置。
如果只是临时修改,可以直接用 ifconfig 命令,这并不影响配置文件。
~$ sudo ifconfig eth0 192.168.0.103 netmask 255.255.255.0
# 立即生效
- Ubuntu - 修改网络配置
- [Linux]Ubuntu配置修改网络连接配置
- Ubuntu命令行修改网络配置方法
- Ubuntu命令行修改网络配置方法配置文件
- Ubuntu命令行下修改网络配置
- Ubuntu命令行修改网络配置方法
- Ubuntu 命令行修改网络配置方法
- ubuntu命令行修改网络配置方法
- Ubuntu命令行修改网络配置方法
- Ubuntu命令行修改网络配置方法
- Ubuntu通过修改配置文件进行网络配置
- Ubuntu 命令行修改网络配置方法
- Ubuntu通过修改配置文件进行网络配置
- Ubuntu 命令行修改网络配置方法
- Ubuntu通过修改配置文件进行网络配置
- Ubuntu通过修改配置文件进行网络配置
- Ubuntu通过修改配置文件进行网络配置
- Ubuntu通过修改配置文件进行网络配置
- 唐僧语录(转)
- c#泛型的使用
- ORACLE directory 目录
- 技术求助
- 厦门雅迅网络 Telematics(汽车远程信息服务)的中国期待
- Ubuntu - 修改网络配置
- 汇编语言笔记(一)
- 取得一个oracle directory object 下的所有文件名 ,多少文件。
- Log4c使用
- 医疗保险,公积金、养老、生育、工伤、失业保险
- 666行汇编代码实现社会化新闻网站
- Apache与PHP配置后重启动Apache提示:the requested operation has failed
- 星云禅话
- Gentoo下安装ZTE 2736上网卡安装设置备忘