设为首页 收藏本站
查看: 617|回复: 0

[经验分享] CentOS7 网络管理与配置

[复制链接]
累计签到:2 天
连续签到:1 天
发表于 2016-3-25 09:03:28 | 显示全部楼层 |阅读模式
在linux下的网络管理大概可以通过两种方式进行实现:命令和配置文件,大部分命令执行以后只能单次生效,而配置文件可以永久生效,根据场景的不同选择不同的方式进行管理。
ifconfig:


ifconfig [-a] interfer  查看当前系统处于活动状态接口
     -a:显示所有接口,包括非活动状态。
1
2
3
4
5
6
7
8
9
[iyunv@bogon yum.repos.d]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 7404  bytes 6161993 (5.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1556  bytes 130066 (127.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0




        eno16777736:网卡名称
        flags:标志位
        UP:网卡启用状态
        BROADCAST:支持广播
        RUNNING:正在运行中
        MULTICAST:支持组播
        mtu:最大传输单源,默认为1500
        init: Ipv4地址

        init6: Ipv6地址

        txqueuelen:传输队列长度   
        RX packets:接受到报文数量
        RX errors:接受时的错误的报文数量
        dropped:丢包的报文数量
        overruns:溢出的报文数量
        frame:帧

修改网络配置:
1
2
3
4
5
6
7
8
9
[iyunv@bogon ~]# ifconfig eno33554984 192.168.77.111/24 up
[iyunv@bogon ~]# ifconfig eno33554984
eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::20c:29ff:fe74:8049  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 102  bytes 17988 (17.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



选项:
[-]promisc启动/关闭混杂模式
[-]allmulti 启动/关闭组播
up
down

route:

route  查看路由

1
2
3
4
5
[iyunv@bogon ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         bogon           0.0.0.0         UG    100    0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736



route -n
1
2
3
4
5
[iyunv@bogon ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.67.2    0.0.0.0         UG    100    0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736




route  add  [-net|-host]  target   [gw GW]  [dev]
            -net:主机路由host,目标地址为单个IP
            -host:网络路径net,目标地址为IP网络
1
2
3
4
5
6
7
8
9
10
11
12
[iyunv@bogon ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         bogon           0.0.0.0         UG    100    0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736
[iyunv@bogon ~]# route add -net 12.0.0.0/8 gw 192.168.67.2 dev eno16777736
[iyunv@bogon ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         bogon           0.0.0.0         UG    100    0        0 eno16777736
12.0.0.0        bogon           255.0.0.0       UG    0      0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736



1
2
3
4
5
6
7
8
[iyunv@bogon ~]# route add -net 13.0.0.0 netmask 255.0.0.0 gw 192.168.67.4 dev eno16777736
[iyunv@bogon ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         bogon           0.0.0.0         UG    100    0        0 eno16777736
12.0.0.0        bogon           255.0.0.0       UG    0      0        0 eno16777736
13.0.0.0        bogon           255.0.0.0       UG    0      0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736




route del [-net|-host] TARGET gw GATEWAY [dev IFNAME]
1
2
3
4
5
6
7
[iyunv@bogon ~]# route del -net 13.0.0.0 netmask 255.0.0.0 gw 192.168.67.4 dev eno16777736
[iyunv@bogon ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         bogon           0.0.0.0         UG    100    0        0 eno16777736
12.0.0.0        bogon           255.0.0.0       UG    0      0        0 eno16777736
192.168.67.0    0.0.0.0         255.255.255.0   U     100    0        0 eno16777736




netstat 命令:显示网路连接,路由表,伪装链接,多播成员关系
1
2
3
4
5
[iyunv@bogon ~]# netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 bogon:ssh               bogon:63059             ESTABLISHED
tcp        0     52 bogon:ssh               bogon:54942             ESTABLISHED



netstat -r:显示内核路由表
netstat -n: 数字格式,不反解IP地址至主机名;
1
2
3
4
5
[iyunv@bogon ~]# netstat -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 192.168.67.128:22       192.168.67.1:63059      ESTABLISHED
tcp        0     52 192.168.67.128:22       192.168.67.1:54942      ESTABLISHED



netstat -t:TCP协议的相关连接,链接均有其状态
1
2
3
4
5
[iyunv@bogon ~]# netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 bogon:ssh               bogon:63059             ESTABLISHED
tcp        0     52 bogon:ssh               bogon:54942             ESTABLISHED



netstat -u:udp协议的相关连接
1
2
3
[iyunv@bogon ~]# netstat -u
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State



netstat -w:raw socket相关的链接
netstat -l:处于监听的链接
1
2
3
4
5
6
[iyunv@bogon yum.repos.d]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN     
tcp        0      0 localhost:ipp           0.0.0.0:*               LISTEN     
tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN



        Proto  协议
        Recv-Q 接受队列
        Send-Q 发送队列
netstat -a:所有状态  (运行,监听)
netstat -n:以数字格式显示IP和Port

netstat -e:显示扩展格式
1
2
3
4
[iyunv@bogon ~]# netstat -e
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode     
tcp        0     52 bogon:ssh               bogon:56488             ESTABLISHED root



netstat -i 显示所有接口
1
2
3
4
[iyunv@bogon ~]# netstat -i
Kernel Interface table
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eno16777  1500      300      0      0 0           137      0      0      0 BMRU



netstat -I<inteferce>
1
2
3
4
[iyunv@bogon ~]# netstat -Ieno33554984
Kernel Interface table
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eno33554  1500        0      0      0 0           140      0      0      0 BMRU




ifup /ifdown 打开、关闭网卡
1
2
3
4
[iyunv@bogon network-scripts]# ifup eno33554984
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/21)
[iyunv@bogon network-scripts]# ifdown eno33554984
Device 'eno33554984' successfully disconnected.



housname
CentOS6:
    查看主机名:hostname

    配置主机名:hostname HOSTNAME
通过修改配置文件配置文件:/etc/sysconfig/network 中 HOSTNAME=<HOSTNAME>
1
2
3
4
[iyunv@localhost ~]# vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain



CentOS7:
hostnamectl status:显示当前主机名设定:
1
2
3
4
5
6
7
8
9
10
11
12
[iyunv@bogon ~]# hostnamectl status
   Static hostname: localhost.localdomain
Transient hostname: bogon
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 5428a4d5a4bb46b8a5d02ecc7d30d003
           Boot ID: c86d23aa109846569cf578d31f2b25e5
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64



hostnamectl set-hostname 设定主机名,永久有效;
1
2
3
4
5
6
7
8
9
10
11
12
13
Unknown operation set-lin
[iyunv@bogon ~]# hostnamectl set-hostname lin
[iyunv@bogon ~]# hostnamectl
   Static hostname: lin
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 5428a4d5a4bb46b8a5d02ecc7d30d003
           Boot ID: c86d23aa109846569cf578d31f2b25e5
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64



ip:
ip link 网络设备配置

ip link set interface down
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@bogon ~]# ip link set eno33554984 down
[iyunv@bogon ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 15526  bytes 1106373 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5354  bytes 933749 (911.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 12  bytes 1020 (1020.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1020 (1020.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip link set interface up
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[iyunv@bogon ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 15568  bytes 1109751 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5378  bytes 937177 (915.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254  bytes 43248 (42.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip link set interface multicast on 开启组播
ip link set interface multicastoff 关闭组播
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[iyunv@bogon network-scripts]# ip link set  eno33554984 multicast off
[iyunv@bogon network-scripts]# ifconfig eno33554984
eno33554984: flags=67<UP,BROADCAST,RUNNING>  mtu 1500
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254  bytes 43248 (42.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[iyunv@bogon network-scripts]# ip link set  eno33554984 multicast on
[iyunv@bogon network-scripts]# ifconfig eno33554984
eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254  bytes 43248 (42.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip link set interface name   NAME 更改设备名称
1
2
3
4
5
6
7
8
[iyunv@bogon network-scripts]# ip link set eno33554984 name eth0
[iyunv@bogon network-scripts]# ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254  bytes 43248 (42.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip link set interface mtu    设置MTU值,默认1500
1
2
3
4
5
6
7
8
root@bogon network-scripts]# ip link set eth0 mtu 1600
[iyunv@bogon network-scripts]# ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1600
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254  bytes 43248 (42.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip netns :创建指定的空间
ip netns list 累出所有的netns
ip netns add name  增加指定的netns
ip netns del name  删除指定的netns
ip netns exec NAME COMMAND指定的netns中运行命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[iyunv@bogon network-scripts]# ip netns list
[iyunv@bogon network-scripts]# ip netns add test
[iyunv@bogon network-scripts]# ip netns list
test
[iyunv@bogon network-scripts]# ip link set eth0 netns test
[iyunv@bogon network-scripts]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 18036  bytes 1295528 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6286  bytes 1033927 (1009.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 12  bytes 1020 (1020.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1020 (1020.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[iyunv@bogon network-scripts]# ip netns del test
[iyunv@bogon network-scripts]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 18104  bytes 1301156 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6323  bytes 1038797 (1014.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.168.66.123  netmask 255.255.255.0  broadcast 192.168.66.255
        inet6 fe80::20c:29ff:fe74:8049  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 262  bytes 43868 (42.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0




ip addr:用来实现管理IP地址
ip addr add IP/MASK dev label  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[iyunv@lin ~]# ip addr add  dev eth0 192.168.77.78/24 label eth0:1
[iyunv@lin ~]# ip addr add  dev eth0 192.168.77.79/24 label eth0:2
[iyunv@lin ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.67.128  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::20c:29ff:fe74:803f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:74:80:3f  txqueuelen 1000  (Ethernet)
        RX packets 19978  bytes 1455021 (1.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7267  bytes 1146820 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.168.77.74  netmask 255.255.255.0  broadcast 0.0.0.0
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 266  bytes 44112 (43.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.168.77.78  netmask 255.255.255.0  broadcast 0.0.0.0
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)

eth0:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.168.77.79  netmask 255.255.255.0  broadcast 0.0.0.0
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)



ip addr delete 删
ip addr show 显示所有路由信息
1
2
3
4
5
6
7
8
9
[iyunv@lin ~]# ip addr delete dev eth0 192.168.77.77/24
[iyunv@lin ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.168.77.74  netmask 255.255.255.0  broadcast 0.0.0.0
        ether 00:0c:29:74:80:49  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 266  bytes 44112 (43.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



ip addr flush  清空所有

ip route
ip route option TPYE PREFIX via[GW] [dev IFACE] [src SOUCE]
ip route add  添加路由
1
2
3
4
[iyunv@lin ~]# ip route add 10.0.0.0/8 via 192.168.67.1
[iyunv@lin ~]# ip route show
default via 192.168.67.2 dev eno16777736  proto static  metric 100
10.0.0.0/8 via 192.168.67.1 dev eno16777736



ip route delete:删除路由
1
2
3
4
5
[iyunv@lin ~]# ip route del 10.0.0.0/8 via 192.168.67.1
[iyunv@lin ~]# ip route show
default via 192.168.67.2 dev eno16777736  proto static  metric 100
192.168.67.0/24 dev eno16777736  proto kernel  scope link  src 192.168.67.128  metric 100
192.168.77.0/24 dev eth0  proto kernel  scope link  src 192.168.77.74



ip route get:获得路由嘻嘻
1
2
3
[iyunv@lin ~]# ip route get 192.168.67.0
broadcast 192.168.67.0 dev eno16777736  src 192.168.67.128
    cache <local,brd>



ip route flush

ss
ss [options] [FILTER]
-t:TCP协议的相关连接
-u: UDP相关连接
-w: raw socket相关的链接
-l:监听状态的了解
-n:数字格式
-p:相关的程序及其PID
-e:扩展格式信息
-m:内存用量
1
2
3
4
[iyunv@lin ~]# ss -tnl
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN      0      128              *:22                           *:*                  
LISTEN      0      128      127.0.0.1:631                          *:*




-o:及其他信息
dport=目标端口
sport=源端口
示例:'( dport=:22 sport=:22 ) '
ss -tan '( dport=:22 or sport=:22 )'
ss -tan state ESTABLISHED

通过修改配置文件来配置网络属性:
IP/NETMASK/GW/DNS:
/etc/sysconfig/network-scripts/ifcfg-IFACE
IFACE:接口名称;

路由的相关配置文件:
/etc/sysconfig/network-scripts/route-IFACE
支持两种配置方式,但不可混用
(1)每行一个路由条目
TARGET via GW
(2)没三行一个路由条目
ADDRESS#=TARGER
NETWORK#=MASK
GATEWAY#=NEXT



配置DNS服务器指向:
配置文件: /etc/resolv.conf 最多有三个主机
nameserver DNS_SERVER_IP

如何测试:(host/nslookup/dig)
/etc/hosts
系统中ping命令是事显查看/etc/hosts文件中是否有IP和域名对应的,没有的话在查看resolv.conf,
因此测试的时候要跳开host文件
    dig -t A 主机名  FQDN(www.baidu.com
    FQDN--> IP
    dig -x IP
    IP--> 主机名


nmcli
device:显示并且网络接口
nmcli device status
nmcli device connect
nmcli device disconnect
nmcli device show

connection:
nmcli connection show
nmcli connection up IFACE
nmcli connectionn down IFACE
nmcli connectionn modify IFACE [+|-]setting address vlue
setting:
ipv4.addresss
ipv4.gateway
ipv4.dns1
ipv4.method 配置方法
manual static?


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-195339-1-1.html 上篇帖子: Linu系统cache强制回收 下篇帖子: Linux之sed详解 网络管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表