0%

RHCSA (EX200) - 配置网络设置

将 node1 配置为具有以下网络配置:

主机名:node1.domain250.example.com

IP 地址:172.25.250.100

子网掩码:255.255.255.0

网关:172.25.250.254

DNS服务器:172.25.250.254

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# VM Control / node1 / Console_node1_VM
clear login: root
Password:
[root@clear ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff
[root@clear ~]# ip address show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff
inet 172.25.250.10/24 brd 172.25.250.255 scope global dynamic noprefixroute eth0
valid_lft 38785sec preferred_lft 38785sec
inet6 fe80::b3ba:2f60:8a37:f33e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[kiosk@foundation0 ~]$ ssh root@172.25.250.10
root@172.25.250.10's password:
[root@clear ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected Wired connection 1
lo loopback unmanaged --
[root@clear ~]# nmcli connection show Wired\ connection\ 1
...
ipv4.method: auto
ipv4.dns: --
ipv4.addresses: --
ipv4.gateway: --
...
[root@clear ~]# nmcli connection modify Wired\ connection\ 1 ipv4.method manual ipv4.addresses 172.25.250.100/24 ipv4.gateway 172.25.250.254 ipv4.dns 172.25.250.254
[root@clear ~]# nmcli connection up Wired\ connection\ 1
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
[kiosk@foundation0 ~]$ ssh root@172.25.250.100
root@172.25.250.100's password:
[root@clear ~]# nmcli connection show Wired\ connection\ 1
ipv4.method: manual
ipv4.dns: 172.25.250.254
ipv4.addresses: 172.25.250.100/24
ipv4.gateway: 172.25.250.254
[root@clear ~]# ip address show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff
inet 172.25.250.100/24 brd 172.25.250.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::b3ba:2f60:8a37:f33e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@clear ~]# ip route
default via 172.25.250.254 dev eth0 proto static metric 100
172.25.250.0/24 dev eth0 proto kernel scope link src 172.25.250.100 metric 100
[root@clear ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search domain250.example.com
nameserver 172.25.250.254
[root@clear ~]# hostname
clear.domain250.example.com
[root@clear ~]# hostnamectl set-hostname node1.domain250.example.com
[root@clear ~]# cat /etc/hostname
node1.domain250.example.com