Sunday, February 8, 2015

nmcli basics and examples

nmcli  is the  cli for network manager which is the new way to configure network and network adaptors in Redhat/Centos 7 and Fedora 21

Here are some basic nmcli commands to get you going.

The nice thing with nmcli is that you can tab through all options ie you don't need to remember all the commands, tab completion will bring them up.

nmcli hitting tab here brings up the following options
con  -- NetworkManager connections
dev  -- devices managed by NetworkManager
nm   -- NetworkManager status

nmcli dev  hitting tab here will bring up the following options
disconnect  -- disconnect device and prevent it from automatically activating
list        -- get detailed information about devices
status      -- print status of devices
wifi        -- list available WiFi access points

similarly
nmcli con  hit tab will bring up the following
delete  -- delete a connection
down    -- deactivate a connection
list down   -- list configured connections
status  -- print status of active connections
up      -- activate a connection

nmcli nm
enable  -- get status or enable/disable networking
sleep   -- get sleep status or put to sleep/awake NetworkManager
status  -- show overall status of NetworkManager
wifi    -- inquire or set status of WiFi in NetworkManager
wwan    -- inquire or set status of WWAN in NetworkManager

To show all configured connections
nmcli con 


To connect to a wifi network

first nmcli dev wifi
to see list of available networks then

nmcli dev wifi connect networkname password inputpassword

switch wifi off
nmcli nm wifi off

Bring eth0 adaptor up

nmcli -p con up id "My wired connection" iface eth0

activates the connection with name "My wired connection" on interface eth0. The -p option makes nmcli show progress of the activation.

Get list
nmcli con

Stop interface
nmcli con down id 'Connection'

Start interface
nmcli con up id 'Connection'

Friday, February 6, 2015

Booting into single user mode and changing root password Centos / Redhat 7


since among other things this process is also now different in redhat 7 / CentOS 7
here is how you do it in redhat 7

During boot, press "e" at the grub loader.
Scroll down using the arrow keys to the line starting with "linux". It would look like this.
linux16 /vmlinuz-3.10.0......
Remove the following from that line. "rhgb" and "quiet".
Add the following to the end of the line. "init=/bin/sh".
Press ctrl+x to continue the boot process.
Once the system is booted, you will be at the root user in single user mode. But this is in a read only file system.
You need to mount the / filesystem.
mount -o remount, rw /
Test that you can write to /, following command should work without error.
touch /tmp/test
Now change your password for root
passwd
Touch the following file to make sure things are ok on SELinux, this is a fix file process.
touch /.autorelabel
Finally start the normal boot process.
exec /sbin/init

You're Done.