1. Runlevel
CentOS7里systemd一统天下,自然/etc/inittab
里面也没有什么配置了:
[root@dms-ag ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
我们来看下systemd是怎么定义的runlevel设置:
默认系统的runlevel,很明显这是一个软链接
[root@dms-ag ~]# ls -al /etc/systemd/system/*.target
lrwxrwxrwx. 1 root root 37 May 19 19:59 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target
下面这个看起来就和以前我们印象里的runlevel 0~6 一致了
[root@dms-ag ~]# ls -al /lib/systemd/system/runlevel*.target
lrwxrwxrwx. 1 root root 15 May 19 22:25 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 May 19 22:25 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 May 19 22:25 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 May 19 22:25 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 May 19 22:25 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 May 19 22:25 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 May 19 22:25 /lib/systemd/system/runlevel6.target -> reboot.target
所以我们要更改系统的默认runlevel,只需要创建一个runlevel的target文件软链接到defaultl.target,如:ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
2. Services
SysV已经退居二线,仅有少量的服务由其管理:
systemctl取代了chkconfig命令:
启动动和禁用服务:
[root@dms-ag ~]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/basic.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
[root@dms-ag ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
## 从上面我们可以看到启动服务实际上市创建一个链接到/usr/lib/systemd/system/目录下
[root@dms-ag ~]# cat /usr/lib/systemd/system/firewalld.service
[Unit]
Description=firewalld - dynamic firewall daemon
Before=network.target
Before=libvirtd.service
Before=NetworkManager.service
After=dbus.service
After=polkit.service
Conflicts=iptables.service ip6tables.service ebtables.service ipset.service
Documentation=man:firewalld(1)
[Service]
EnvironmentFile=-/etc/sysconfig/firewalld
ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
# supress to log debug and error output also to /var/log/messages
StandardOutput=null
StandardError=null
Type=dbus
BusName=org.fedoraproject.FirewallD1
[Install]
WantedBy=basic.target
Alias=dbus-org.fedoraproject.FirewallD1.service
## 常用的systemctl命令
[root@dms-ag ~]# systemctl start firewalld
[root@dms-ag ~]# systemctl restart firewalld
[root@dms-ag ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2017-07-17 10:16:28 CST; 4s ago
Docs: man:firewalld(1)
Main PID: 3206 (firewalld)
CGroup: /system.slice/firewalld.service
└─3206 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jul 17 10:16:28 dms-ag systemd[1]: Starting firewalld - dynamic firewall daemon...
Jul 17 10:16:28 dms-ag systemd[1]: Started firewalld - dynamic firewall daemon.
[root@dms-ag ~]# systemctl stop firewalld
3. 网络
setup工具还是保留,但是没有了网络配置:
来看向网络相关配置:
[root@dms-ag ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 192.168.88.2
[root@dms-ag ~]# cat /etc/sysconfig/network
# Created by anaconda
[root@dms-ag ~]# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 1 root root 266 May 19 21:33 /etc/sysconfig/network-scripts/ifcfg-eth0
-rw-r--r-- 1 root root 272 Jun 22 10:17 /etc/sysconfig/network-scripts/ifcfg-eth1
-rw-r--r--. 1 root root 254 Sep 12 2016 /etc/sysconfig/network-scripts/ifcfg-lo
[root@dms-ag ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.88.128 netmask 255.255.255.0 broadcast 192.168.88.255
ether 00:0c:29:b2:57:e7 txqueuelen 1000 (Ethernet)
RX packets 407 bytes 37991 (37.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 240 bytes 22668 (22.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.57.111 netmask 255.255.255.0 broadcast 192.168.57.255
ether 00:0c:29:b2:57:f1 txqueuelen 1000 (Ethernet)
RX packets 2587 bytes 253715 (247.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1561 bytes 333064 (325.2 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
loop txqueuelen 1 (Local Loopback)
RX packets 4 bytes 340 (340.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 340 (340.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
## 修改主机名
### 方法1
[root@dms-ag ~]# echo hostname test >>/etc/sysconfig/network
[root@dms-ag ~]# cat /etc/sysconfig/network
# Created by anaconda
hostname test
[root@dms-ag ~]#
Connection closed.
Disconnected from remote host(dms-ag) at 10:24:43.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
Connecting to 192.168.57.111:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jul 17 09:39:58 2017 from 192.168.57.1
[root@test ~]#
### 方法2
[root@test ~]# hostnamectl set-hostname dms-ag
[root@test ~]# logout
Connection closed by foreign host.
Disconnected from remote host(dms-ag) at 10:26:31.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
Connecting to 192.168.57.111:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jul 17 10:24:53 2017 from 192.168.57.1
[root@dms-ag ~]#
## 查看网卡配置文件
[root@dms-ag ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
DEVICE=eth0
ONBOOT=yes
没有了70-persistent-net.rules
文件:
[root@dms-ag ~]# ll /etc/udev/rules.d/
total 4
-rw-r--r--. 1 root root 709 Nov 6 2016 70-persistent-ipoib.rules
3.1 网络管理
CentOS最小化安装时“ifconfig”、“netstat”、“route”、“arp”命令都没有,我们需要收手动安装对应的包:
[root@dms-ag ~]# yum provides ifconfig
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /usr/sbin/ifconfig
[root@dms-ag ~]# yum install net-tools -y
默认ip、ss命令代替了ifconfig、route、arp、netstat
ip命令入门:
[root@dms-ag ~]# ip
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
ip [ -force ] -batch filename
where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
netns | l2tp | macsec | tcp_metrics | token }
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
-h[uman-readable] | -iec |
-f[amily] { inet | inet6 | ipx | dnet | bridge | link } |
-4 | -6 | -I | -D | -B | -0 |
-l[oops] { maximum-addr-flush-attempts } |
-o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
-rc[vbuf] [size] | -n[etns] name | -a[ll] }
## 查看网络接口,ifconfig
[root@dms-ag ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:b2:57:e7 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.128/24 brd 192.168.88.255 scope global dynamic eth0
valid_lft 1365sec preferred_lft 1365sec
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:b2:57:f1 brd ff:ff:ff:ff:ff:ff
inet 192.168.57.111/24 brd 192.168.57.255 scope global eth1
valid_lft forever preferred_lft forever
## 网卡统计信息
[root@dms-ag ~]# ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
340 4 0 0 0 0
TX: bytes packets errors dropped carrier collsns
340 4 0 0 0 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:b2:57:e7 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
14769780 10717 0 0 0 0
TX: bytes packets errors dropped carrier collsns
124214 1885 0 0 0 0
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:b2:57:f1 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
333521 3418 0 0 0 0
TX: bytes packets errors dropped carrier collsns
416698 2099 0 0 0 0
## 显示和设置路由
[root@dms-ag ~]# ip route show |column -t
default via 192.168.88.2 dev eth0 proto static metric 100
192.168.57.0/24 dev eth1 proto kernel scope link src 192.168.57.111 metric 100
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.128 metric 100
[root@dms-ag ~]# ip route show |column -t
default via 192.168.88.2 dev eth0 proto static metric 100
192.168.57.0/24 dev eth1 proto kernel scope link src 192.168.57.111 metric 100
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.128 metric 100
[root@dms-ag ~]# ip route add 10.0.0.0/8 via 192.168.88.128 dev eth0
[root@dms-ag ~]# ip route show | column -t
default via 192.168.88.2 dev eth0 proto static metric 100
10.0.0.0/8 via 192.168.88.128 dev eth0
192.168.57.0/24 dev eth1 proto kernel scope link src 192.168.57.111 metric 100
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.128 metric 100
[root@dms-ag ~]# ip route del 10.0.0.0/8
[root@dms-ag ~]# ip route show | column -t
default via 192.168.88.2 dev eth0 proto static metric 100
192.168.57.0/24 dev eth1 proto kernel scope link src 192.168.57.111 metric 100
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.128 metric 100
ip route 指令对路由的修改不能保存,重启就没了。把 ip route 指令写到 /etc/rc.local 也是徒劳的。
RHEL7官网文档没有提到 /etc/sysconfig/static-routes,经测试此文件已经无效;
/etc/sysconfig/network 配置文件仅仅可以提供全局默认网关,语法同 Centos6 一样: GATEWAY=<ip address>;永久静态路由需要写到 /etc/sysconfig/network-scripts/route-interface 文件中,比如添加两条静态路由:echo "10.15.150.0/24 via 192.168.150.253 dev enp0s3" > /etc/sysconfig/network-scripts/route-eth0
其他需要注意的:
1)连接配置文件 ifcfg-* 里可以设置多个GATEWAY,一般第一个是 GATEWAY0,然后GATEWAY1, GATEWAY2... ,尾号最大的有效;
2)如果必须在/etc/sysconfig/network 文件定义全局网关,连接配置文件 ifcfg-* 就不要设置GATEWAY了,dhcp的连接要注意dhcp服务器不要定义默认网关。
3)ifcfg-enp0s3 文件改名为 ifcfg-eth0 后,route-enp0s3 文件也要改名为 route-eth0。
使用ip neighbour 代替 arp -n
[root@dms-ag ~]# ip nei
192.168.88.2 dev eth0 lladdr 00:50:56:e2:3f:ce STALE
192.168.57.1 dev eth1 lladdr 00:50:56:c0:00:01 DELAY
192.168.88.254 dev eth0 lladdr 00:50:56:f4:9b:02 STALE
[root@dms-ag ~]# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.88.2 ether 00:50:56:e2:3f:ce C eth0
192.168.57.1 ether 00:50:56:c0:00:01 C eth1
192.168.88.254 ether 00:50:56:f4:9b:02 C eth0
使用ss代替netstat
[root@dms-ag ~]# ss -lntp | column -t
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:* users:(("httpd",pid=4051,fd=3),("httpd",pid=4050,fd=3),("httpd",pid=4033,fd=3),("httpd",pid=4031,fd=3),("httpd",pid=4030,fd=3),("httpd",pid=1037,fd=3))
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1040,fd=3))
LISTEN 0 128 127.0.0.1:631 *:* users:(("cupsd",pid=1032,fd=11))
LISTEN 0 128 *:443 *:* users:(("httpd",pid=4051,fd=4),("httpd",pid=4050,fd=4),("httpd",pid=4033,fd=4),("httpd",pid=4031,fd=4),("httpd",pid=4030,fd=4),("httpd",pid=1037,fd=4))
LISTEN 0 5 127.0.0.1:25151 *:* users:(("cobblerd",pid=3982,fd=17))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1040,fd=4))
[root@dms-ag ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1037/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1040/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1032/cupsd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1037/httpd
tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN 3982/python2
tcp6 0 0 :::22 :::* LISTEN 1040/sshd
网络配置文件
/etc/sysconfig/network 说是全局设置,默认里面啥也没有,可以添加全局默认网关
/etc/hostname 用nmtui修改hostname后,主机名保存在这里
/etc/resolv.conf 保存DNS设置,不需要手工改,nmtui里面设置的DNS会出现在这里
/etc/sysconfig/network-scripts/ 连接配置信息 ifcfg 文件
/etc/NetworkManager/system-connections/ VPN、移动宽带、PPPoE连接
3.2 nmtui配置基本网络连接
nmtui 属于curses-based text user interface(文本用户界面), 类似 Centos6 的 setup 工具,但只能编辑连接、启用/禁用连接、更改主机名。系统初装之后可以第一时间用nmtui配置网络,挺方便。
看图吧,功能跳转可以用 tab 键或光标键,用空格或回车执行。每个子功能完成了、退出了或取消了会直接回命令行(觉得不方便就试试 nmtui help,有直达的方法)。
3.3 nmcli和其他网络设置
[root@dms-ag ~]# nmcli -h
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
-t[erse] terse output
-p[retty] pretty output
-m[ode] tabular|multiline output mode
-c[olors] auto|yes|no whether to use colors in output
-f[ields] <field1,field2,...>|all|common specify fields to output
-e[scape] yes|no escape columns separators in values
-a[sk] ask for missing parameters
-s[how-secrets] allow displaying passwords
-w[ait] <seconds> set timeout waiting for finishing operations
-v[ersion] show program version
-h[elp] print this help
OBJECT
g[eneral] NetworkManager's general status and operations
n[etworking] overall networking control
r[adio] NetworkManager radio switches
c[onnection] NetworkManager's connections
d[evice] devices managed by NetworkManager
a[gent] NetworkManager secret agent or polkit agent
m[onitor] monitor NetworkManager changes
OBJECT和COMMAND可以用全称也可以用简称,最少可以只用一个字母,建议用头三个字母。OBJECT里面我们平时用的最多的就是connection和device,这里需要简单区分一下connection和device。
device叫网络接口,是物理设备
connection是连接,偏重于逻辑设置
多个connection可以应用到同一个device,但同一时间只能启用其中一个connection。
这样的好处是针对一个网络接口,我们可以设置多个网络连接,比如静态IP和动态IP,再根据需要up相应的connection。
上面说了,/etc/udev/rules.d/70-persistent-net.rules 文件没有了,新添加的网卡NetworkManager自动识别。
[root@dms-ag ~]# nmcli c show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0
eth1 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 802-3-ethernet eth1
[root@dms-ag ~]# nmcli dev show eth0
GENERAL.DEVICE: eth0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:B2:57:E7
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: eth0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.88.128/24
IP4.GATEWAY: 192.168.88.2
IP4.DNS[1]: 192.168.88.2
IP4.DOMAIN[1]: localdomain
IP6.GATEWAY:
[root@dms-ag ~]# nmcli dev show eth1
GENERAL.DEVICE: eth1
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:B2:57:F1
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: eth1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.57.111/24
IP4.GATEWAY:
IP6.GATEWAY:
[root@dms-ag ~]# nmcli -t -f IP4.ADDRESS dev show eth0
IP4.ADDRESS[1]:192.168.88.128/24
[root@dms-ag ~]# nmcli con add con-name eth0-1 ifname eth0 type ethernet ip4 192.168.88.200
Connection 'eth0-1' (3f4d1b6c-929c-4f89-affe-9a6072a53dd6) successfully added.
[root@dms-ag ~]# nmcli con show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0
eth1 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 802-3-ethernet eth1
eth0-1 3f4d1b6c-929c-4f89-affe-9a6072a53dd6 802-3-ethernet --
[root@dms-ag ~]# nmcli con up eth0-1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@dms-ag ~]# nmcli -t -f IP4.ADDRESS dev show eth0
IP4.ADDRESS[1]:192.168.88.200/32
[root@dms-ag ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0-1
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.88.200
PREFIX=32
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0-1
UUID=3f4d1b6c-929c-4f89-affe-9a6072a53dd6
DEVICE=eth0
ONBOOT=yes
[root@dms-ag ~]# nmcli con down eth0-1
Connection 'eth0-1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@dms-ag ~]# nmcli con up eth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
[root@dms-ag ~]# nmcli con delete eth0-1
Connection 'eth0-1' (3f4d1b6c-929c-4f89-affe-9a6072a53dd6) successfully deleted.
[root@dms-ag ~]# nmcli con show
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0
eth1 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 802-3-ethernet eth1
[root@dms-ag ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:b2:57:e7 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.128/24 brd 192.168.88.255 scope global dynamic eth0
valid_lft 1774sec preferred_lft 1774sec
inet6 fe80::ec2f:eb00:c9f6:4250/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:b2:57:f1 brd ff:ff:ff:ff:ff:ff
inet 192.168.57.111/24 brd 192.168.57.255 scope global eth1
valid_lft forever preferred_lft forever
BONUS:如果有物理WLAN,nmcli能查看wifi,瞅瞅来,好玩吧?(示例来自nmcli-examples(5) man page,指令: man 5 nmcli-examples)
$ nmcli device wifi list
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
netdatacomm_local Infra 6 54 MB/s 37 ▂▄__ WEP
* F1 Infra 11 54 MB/s 98 ▂▄▆█ WPA1
LoremCorp Infra 1 54 MB/s 62 ▂▄▆_ WPA2 802.1X
Internet Infra 6 54 MB/s 29 ▂___ WPA1
HPB110a.F2672A Ad-Hoc 6 54 MB/s 22 ▂___ --
https://www.linux.com/learn/understanding-and-using-systemd
https://www.linux.com/learn/here-we-go-again-another-linux-init-intro-systemd
https://www.linux.com/learn/intro-systemd-runlevels-and-service-management-commands