Network Configuration

Commands for network interface configuration, routing, service management, and network file management

Interface Configuration

ip link set [interface] up/down

  • Enables/disables network interface

ip addr add [ip/mask] dev [interface]

  • Assigns IP address to interface

ip route add [network] via [gateway]

  • Adds static route

Network Files

/etc/network/interfaces

  • Main network configuration file

/etc/resolv.conf

  • DNS resolver configuration

/etc/hosts

  • Static hostname resolution

Service Management

systemctl restart networking

  • Restarts network service

systemctl enable networking

  • Enables networking at boot

ifup [interface]

  • Brings interface up

ifdown [interface]

  • Brings interface down

Verification

ip addr show

  • Shows all interface IP addresses

ip route show

  • Displays routing table

ping -c 4 [host]

  • Tests connectivity (4 packets)

ss -tuln

  • Shows listening ports

Example Config

1
2
3
4
5
6
7
# /etc/network/interfaces
auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8