Lesson 1.17: Configuring Networks


Basic Network Information

# Using ifconfig to get ipaddress, netmask , broadcast
[sanjeeb@client ~]$ ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.208.130  netmask 255.255.255.0  broadcast 192.168.208.255
        inet6 fe80::20c:29ff:fe52:db8f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:52:db:8f  txqueuelen 1000  (Ethernet)
        RX packets 1259150  bytes 1254985243 (1.1 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 514460  bytes 32032532 (30.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 46  memory 0x3fe00000-3fe20000  
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 112  bytes 10108 (9.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 112  bytes 10108 (9.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
# Viewing username
[sanjeeb@client ~]$ whoami
sanjeeb
 
# Viewing ipaddress
[sanjeeb@client ~]$ hostname -I 
192.168.208.130 
 
# Viewing gateway
[sanjeeb@client ~]$ route -n 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.208.2   0.0.0.0         UG    100    0        0 ens160
192.168.208.0   0.0.0.0         255.255.255.0   U     100    0        0 ens160
 
# Viewing DNS or nameserver
[sanjeeb@client ~]$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 192.168.208.2
 

Changing hostname

[root@www ~]# hostnamectl set-hostname sanjeeb 
[root@www ~]# hostname 
sanjeeb
All systems normal

© 2025 2023 Sanjeeb KC. All rights reserved.