Lesson 4

Dates: 2/12/2014
Linux networking
Linux for Engineering and IT Applications


Configuring Linux on a network


  • Configuring the network interface and routing by
    using commands /sbin/ifconfig and /sbin/route

    Check the interface configuration:
    /sbin/ifconfig
    
    Check the routing configuration:
    /sbin/route -n
    
    or
    netstat -nr
    

    Stop the interface:
    /sbin/ifconfig eth0 down
    
    or
    /sbin/ifdown eth0
    

    Configure the interface:
    /sbin/ifconfig eth0 192.168.5.18 netmask 255.255.255.0 up
    
    Configure the routing to the gateway:
    /sbin/route add default gw 192.168.5.240 eth0
    

  • Configuring the network interface and routing by using the startup scripts.

    Static IP address configuration on Ubuntu in /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 192.168.5.18
    netmask 255.255.255.0
    gateway 192.168.5.240
    

    Dynamic (DHCP) configuration on Ubuntu:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet dhcp
    

    For the name resolution, configure /etc/hosts, /etc/resolv.conf, /etc/nsswitch.conf


  • Take me to the Course Website