Configure networking and hostname resolution statically or dynamically

How to see the hostname

$ hostname
cliente1v.example.com

How to see more details: hostnamectl

$ hostnamectl
Static hostname: cliente1v.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: 0fea0ecb371a4cf292e749a764edba32
Boot ID: f267b1u1d22b4cf4488c62d24fee9425
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.el7.x86_64
Architecture: x86-64

How to change the name of the host:

$ hostnamectl set-hostname nombrenuevo.dominio.com

How to know my active connections:

$ nmcli connection show

How to know all my connections:

$ nmcli device s
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
eth0 ethernet connected eth0
lo loopback unmanaged —
virbr0-nic tun unmanaged —

How to see details of an particular device:

$ nmcli -p connection show eth0 | less

How toModify a network:

# nmcli connection modify eth0 ipv4.addresses x.x.x.x/xx ipv4.gateway x.x.x.x ipv4.dns x.x.x.x ipv4.method manual connection.autoconnect yes

How toup/down networks connections:

$ nmcli connection up eth0
$ nmcli connection down eth0

How to delete a network:

nmcli connection delete eth0

How to create a new one:

$ nmcli connection add type ethernet ifname eth0 con-name eth0 ipv4.addresses 192.168.x.x/xx ipv4.gateway 192.168.x.x ipv4.dns 192.168.x.x ipv4.method manual connection.autoconnect yes

How to restart network service

# systemctl restart network.service

Other tool option:

# nmtui

Configuration file:

# cat /etc/sysconfig/network-scripts/your_network_device

TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.x.x
PREFIX=24
GATEWAY=192.168.x.x
DNS1=192.168.x.x
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=df080d27-71a4cf292-4414-882e-0f66fecbe0da
DEVICE=eth0
ONBOOT=yes

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *