I have linux redhat machine version 6.5
I reboot machine and work as single user mode ,
then I set the network on eth0 with default gw address
/etc/sysconfig/network-script/ifcfg-eth0
but from some reason dg address not appears from netstat -rn after service network restart
my question – can we set default gw address and start network when we in single user mode ?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Single-user mode by definition does not implement networking at startup. To put it in sysV runlevel terms, you want runlevel 2 (local multi-user with networking). You can switch to this with telinit 2.
The standard runlevel definitions are:
- 0 – Halt the system
- 1 – Single-user mode
- 2 – Multi-user with networking, but no network services (e. g. NFS)
- 3 – Multi-user with networking and services
- 4 – Undefined
- 5 – Multi-user with networking, services, and GUI (e. g. Xorg)
- 6 – Reboot the system.
Method 2
Bringing network up in single user mode
ifconfig eth0 xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.x up route add default gw xxx.xxx.xxx.x ip route list
Ping IP address from outside and check whether it is pinging or not.
Method 3
TLDR: Yes it is possible to start in single user mode, and then add networking.
The best way to do depends on your machine.
As per Yaroslav Nikitenko’s comment, it can be as simple as:
systemctl network start
Or, as per Venkatesh’s answer, you can probably give the commands directly:
ifconfig eth0 xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.x up route add default gw xxx.xxx.xxx.x ...
It isn’t necessary to go to runlevel 2. If you do, it will probably work, but it isn’t guaranteed. It just depends on how runlevel 2 is defined on your machine.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0