In this quick tutorial we will show you how to enable SSH Access and configure network in rescue mode. Before you start boot into rescue mode using the DVD.
01/ Enable and Configure network in rescue mode
01- Show available network devices:
sh-4.2# ip link 1: lo:mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno16777984: mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000 link/ether 00:50:56:a3:5d:a3 brd ff:ff:ff:ff:ff:ff
02- Set the required network device UP
:
sh-4.2# ip link set dev eno16777984 up
– Now use the below command to check the state of the device:
sh-4.2# ip link 1: lo:mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno16777984: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000 link/ether 00:50:56:a3:5d:a3 brd ff:ff:ff:ff:ff:ff
03- Now let’s assign an IP Address/netmask to the specific interface device:
sh-4.2# ip addr add 10.11.44.20/24 dev eno16777984
– After that, use the follow command to verify the assigned IP:
sh-4.2# ip a 1: lo:mtu 65536 qdisc noqueue state UNKNOWN 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 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eno16777984: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:a3:5d:a3 brd ff:ff:ff:ff:ff:ff inet 10.11.44.20/24 scope global eno16777984 valid_lft forever preferred_lft forever inet6 fe80::250:56ff:fea3:5da3/64 scope link valid_lft forever preferred_lft forever
04- If needed, add the a static route to the network as below:
sh-4.2# ip route add default via 10.72.44.1
– Finally, verify the static route by running the below command:
sh-4.2# ip route default via 10.11.44.1 dev eno16777984 10.11.44.0/24 dev eno16777984 proto kernel scope link src 10.11.44.20
02/ Enable SSH access in rescue mode
Everything is ready from a network point of view. Now we have to start SSH daemon so we can connect to the server.
01- First, we need to locate the ssh_config
file:
sh-4.2# find / -name "*sshd_config*" /etc/ssh/sshd_config.anaconda
02- Now, we need to create the sshd_config
without it the SSH daemon won’t be able to start
sh-4.2# cp /etc/ssh/sshd_config.anaconda /etc/ssh/sshd_config
03- Finally, Start SSH daemon:
sh-4.2# systemctl start sshd
Conclusion
You have successfully learned how to enable and configure Network and SSH in rescue mode on your CentOS server. You might want to check the following guides: