Try   HackMD
tags: Linux

How to enable SSH access & configure network in rescue mode (CentOS/RHEL 7/8)

It is simple but useful, especially you may need it able to connect to the network and save all you stuff inside it, long story short, by doing do:

1. Configure network in rescue mode

Run the below command and check what is the name of your network adapter:

ip a

Then run the below command to turn the network on

ip link set dev <dev> up
ip link
ip addr add <ip address>/<netmask> dev <device>

for example, if your network adapter is called eno1, and you want to assign it as 192.168.1.2, subnet mask is 255.255.255.0, then it should be:

ip link set dev eno1 up
ip link
ip addr add 192.168.1.2/24 dev eno1

then add default gateway for it

ip route add default via <gateway ip address>

For example, it the default gateway is 192.168.1.1, then:

ip route add default via 192.168.1.1

And Done!