hostname和网络设置
2017-07-19 11:18
183 查看
1.修改主机名称
[root@centos ~]# vim /etc/sysconfig/network
打开文件,修改以下内容并保存(永久生效),需要重启reboot
[root@centos ~]# hostname centos #立即生效,临时生效
2.修改网卡
[root@centos ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
打开文件,修改以下内容并保存
3.修改DNS
[root@centos ~]# vim /etc/resolv.conf
打开文件,修改以下内容并保存
4.重新启动网络配置
[root@centos ~]#service network restart
5.重启
[root@centos ~]#reboot
6.查看当前IP设置
[root@centos ~]# ifconfig
7.测试是否连接外网
[root@centos ~]# ping www.baidu.com
[root@centos ~]# vim /etc/sysconfig/network
打开文件,修改以下内容并保存(永久生效),需要重启reboot
NETWORKING=yes #使用网络 HOSTNAME=centos #设置主机名称 NTPSERVERARGS=iburst
[root@centos ~]# hostname centos #立即生效,临时生效
2.修改网卡
[root@centos ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
打开文件,修改以下内容并保存
DEVICE=eth0 #对应第一张网卡 TYPE=Ethernet ONBOOT=yes #是否启动时运行 NM_CONTROLLED=yes BOOTPROTO=static #使用静态IP,而不是由DHCP分配IP DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth0" #名称 HWADDR=00:50:56:94:04:3C #必须对应etho是的MAC地址(/etc/udev/rules.d/70-persistent-net.rules) PEERDNS=yes PEERROUTES=yes IPADDR=192.168.1.128 #指定本机IP地址 NETMASK=255.255.255.0 #指定子网掩码 GATEWAY=192.168.1.2 #指定网关 DNS1=192.168.1.2
3.修改DNS
[root@centos ~]# vim /etc/resolv.conf
打开文件,修改以下内容并保存
nameserver 8.8.8.8 #GOOGLE的DNS服务器 nameserver 192.168.1.2 #指定经路由器上指定的DNS服务器
4.重新启动网络配置
[root@centos ~]#service network restart
5.重启
[root@centos ~]#reboot
6.查看当前IP设置
[root@centos ~]# ifconfig
7.测试是否连接外网
[root@centos ~]# ping www.baidu.com
相关文章推荐
- 网络共享打印安全设置规范
- 优化Oracle网络设置的方案
- Centos在vm中设置网络环境、防火墙设置
- python爬虫设置网络代理
- Android从网络获取图片并设置缓存
- CentOS 网络设置修改
- Win8大百科01期:不同以往的网络设置
- VM虚拟机网络设置
- win10网络位置怎么设置 win10网络位置设置图文教程
- LinuxIP设置,网络负载
- vm虚拟机上外网网络设置
- linux网络设置命令
- linux操作系统基础(5)网络设置内容
- vmware下centos克隆功能对网络的设置
- 办公网络中内外网同时使用的设置问题
- 虚拟机VirtualBox中装Ubuntu的网络设置
- 在VMware Workstation中安装Ubuntu设置网络连接
- 虚拟机下的ubuntu12.04设置桥接网络
- 请问一下,我这个demo设置了从缓存获取数据,为什么每次运行都是从网络获取数据呢?