Manual NIC Setup

Manually setting up a network interface. This can come in handy if you need networking but don’t have any network scripts to rely upon. Setting up a NIC manually is no big deal, so here’s how to do it.


Setting up a Static IP

  1. load the network driver
  2. insmod your_drivername
  3. Set up your local loopback
  4. ifconfig lo 127.0.0.1
    route add 127.0.0.0 lo
    
  5. Set up your ethernet card
  6. ifconfig eth0 192.168.0.2 netmask 255.255.255.0
    route add 192.168.0.2 eth0
    
  7. View the results
    • ifconfig
    • FIXME: Insert ifconfig sample here 
             showing the result of the above 
             configuration statements.
      
    • route -n
    • route -n
      
      Kernel IP routing table
      Destination  Gateway  Genmask         Flags  MSS Window  irtt Iface
      192.168.0.2  0.0.0.0  255.255.255.255 UH       0 0          0 eth0
      192.168.0.0  0.0.0.0  255.255.255.0   U        0 0          0 eth0
      127.0.0.0    0.0.0.0  255.0.0.0       U        0 0          0 lo
      
      FIXME: Make sure the above listing is correct
             according to the above configuration statements.
      


Setting up a Dynamic IP:

You won’t have an UH entry in the route table.
You won’t assign an IP to eth0, you will run pump -i eth0

FIXME: Insert more content here showing the same
       ideas that the static ip showed.

Note: The following was able to get me up and going using some Linux install disks:

ifconfig lo 127.0.0.1
ifconfig eth0 192.168.0.2 netmask 255.255.255.0
route add 192.168.0.2 eth0
route add 127.0.0.1 lo

By shibaa987

Linux kernel developer and a firmware developer with an experience of 10+ years.

Leave a comment

Your email address will not be published. Required fields are marked *