/etc/network/interfacese
#iface enp1s0 inet dhcp #indicates that interface take networking setting from dhcp server .
iface enp1s0 inet static #add interface configuration manually
address 10.10.10.1 #IP address.
network 10.10.10.0 #network address.
netmask 255.255.255.0 #subnet mask.
broadcast 10.10.10.255 #broadcast address.
gateway 113.30.150.61 #is used to define the default gateway for the eth0 interface.
dns-nameservers 8.8.8.8. #is the section where we define DNS servers.
Disable IPv6
Disable IPV6 if you do not need it.
#echo "net.ipv6.conf.all.disable_ipv6 = 1 >> /etc/sysctl.conf
Use bellow command to see results:
sysctl -p
Applying the Configuration
#sysctl restart ifup@enp1s0
Set Temporary addresses
#ifconfig eth0 192.168.1.4 netmask 255.255.255.0 broadcast 192.168.1.255
DNS
/etc/resolve.conf
domain homenetworking.net
search homenetworking.ir
nameserver 8.8.8.8
nameserver 8.8.4.4
Routing
List main route table
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 113.30.150.254 0.0.0.0 UG 0 0 0 eth0
113.30.150.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.10.128 0.0.0.0 255.255.255.192 U 0 0 0 br0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
Add/Delete Routes Temporary
# route add -host 10.10.10.129 dev eth1
# route add -net 10.10.10.128/26 dev eth0
# route add -net 172.16.10.1/24 gw 10.10.10.130
# route del -net 192.168.1.0/24 dev eth1
# route del default
# route add default gw 10.10.10.129 dev eth1
[…] Operating Systems Configure Networking in Ubuntu 18.04 and above OldĀ UbuntuĀ Releases IP setting Configure Networking in Debian 12 Networking in oldest […]