For this example demonstration we will use:
Router IP address - 192.168.0.1
Subnet - 255.255.255.248
PC IP address - 192.168.0.4
PC network device - eth0
DNS server - 8.8.8.8
1. sudo ifconfig -a eth0 192.168.0.4 netmask 255.255.255.248
2. sudo route add default gw 192.168.0.1
B. Using CLI command to configure dynamic IP, subnet & default gateway:
1. sudo dhclient eth0
C. Using Text editor to configure static IP, subnet & default gateway:
1. Open using a Text editor "/etc/network/interfaces" with Root privileges
2. In the end of the file add:
auto eth0
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.248
gateway 192.168.0.1
3. Save & close the text editor
4. Stop the network service: sudo /etc/init.d/networking stop
5. Start the network service: sudo /etc/init.d/networking start
D. Using a Text edit to configure dynamic IP, subnet & default gateway:
1. Open using a Text editor "/etc/network/interfaces" with Root privileges
2. In the end of the file add:
auto eth0
iface eth0 inet dhcp
3. Save & close the text editor
4. Stop the network service: sudo /etc/init.d/networking stop
5. Start the network service: sudo /etc/init.d/networking start
E. Using a Text editor to configure DNS servers:
1. Open using a Text editor "/etc/resolve.conf" with Root privileges
2. In the end of the file add:
nameserver 192.168.0.1
nameserver 8.8.8.8
3. Save & close the text editor
Hope that it will help somebody.
