CentOS网络相关设置(vim手工配置)
CentOS网络相关设置(vim手工配置)
网络相关的几个命令如下:
>>>>配置固定IP地址<<<<
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:D1:A6:ED
ONBOOT=yes
IPADDR=192.168.160.11
NETMASK=255.255.255.0
BROARDCAST=192.168.160.255
GATEWAY=192.168.160.1
[root@localhost ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@localhost ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:A6:ED
inet addr:192.168.160.11 Bcast:192.168.160.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed1:a6ed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13960 errors:0 dropped:0 overruns:0 frame:0
TX packets:4796 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3749651 (3.5 MiB) TX bytes:480572 (469.3 KiB)
Interrupt:75 Base address:0x2000
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:D1:A6:ED
ONBOOT=yes
IPADDR=192.168.160.11
NETMASK=255.255.255.0
BROARDCAST=192.168.160.255
GATEWAY=192.168.160.1
[root@localhost ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@localhost ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:A6:ED
inet addr:192.168.160.11 Bcast:192.168.160.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed1:a6ed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13960 errors:0 dropped:0 overruns:0 frame:0
TX packets:4796 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3749651 (3.5 MiB) TX bytes:480572 (469.3 KiB)
Interrupt:75 Base address:0x2000
>>>>配置DNS地址<<<<
[root@localhost ~]# vi /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.160.1
nameserver 202.101.172.46
>>>>修改主机名<<<<
[root@localhost ~]#vi /etc/sysconfig/network
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=leekwen.leekwen
[root@localhost ~]# ifconfig eth0
[root@localhost ~]# vi /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.160.1
nameserver 202.101.172.46
[root@localhost ~]# vi /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.160.1
nameserver 202.101.172.46
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26