How to configure a static IP or DHCP and DNS on Kubuntu

DHCP

– Modify ‘interfaces’ file at /etc/network/.

Kubuntu_Server# pico /etc/network/interfaces

 

# The primary network interface – use DHCP to find our address
auto eth0
iface eth0 inet dhcp

 

 

– After modified the file, reset or restart ethernet interface

Kubuntu_Server$ sudo /etc/init.d/networking restart

or

Kubuntu_Server# /etc/init.d/networking restart

 

** GUI tools might not working properly. Use above CLI, it must work

 

Static IP

– Modify ‘interfaces’ file at /etc/network/.

Kubuntu_Server# pico /etc/network/interfaces

 

# The primary network interface – use DHCP to find our address
auto eth0
iface eth0 inet static
address 192.168.1.100
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

 

– After modified the file, reset or restart ethernet interface

Kubuntu_Server$ sudo /etc/init.d/networking restart

or

Kubuntu_Server# /etc/init.d/networking restart

 

DNS

– Modify ‘interfaces’ file at /etc/network/.

Kubuntu_Server# pico /etc/resolv.conf

 

# Type primary nameserver

search ipbalance.com
nameserver 192.168.1.200

 

– After modified the file, reset or restart ethernet interface

Kubuntu_Server$ sudo /etc/init.d/networking restart

or

Kubuntu_Server# /etc/init.d/networking restart

 

 

Host name change

Kubuntu_Server$ sudo /bin/hostname

 

 

Routing table

Kubuntu_Server# /sbin/route -n

 

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *               255.255.255.0   U     0      0        0 ra0
172.16.1.0    *               255.255.255.0   U     0      0        0 eth0
172.16.2.0    *               255.255.255.0   U     0      0        0 eth1
default         192.168.1.254   0.0.0.0         UG    0      0        0 ra0

 

Adding route

Kubuntu_Server$ sudo route add default gw 172.16.200.1

 

Netstat

Kubuntu_Server$ netstat -nat
Kubuntu_Server$ sudo netstat -tul
Kubuntu_Server$ netstat -tue

-i: interface tx/rx stat

-p: TCP/UDP Port

-t : TCP connections

-u : UDP connections

-e : Established

 

 

 

 

 

 

 

 

 

 

Leave a Reply