IP
Internet Protocol. RFC 791. Without it you would not read this.
Obtaining
To obtain a standard IPv4 address, you can either specify it manually, or request one if you have a dhcpd server on your subnet. We'll assume in this example that your ethernet interface is "eth0". You should be able to find your interface by typing
$ /sbin/ifconfig
otherwise you will have to find your NIC.
To request an IP you will require the application called dhclient, it should be as simple as that
# dhclient eth0 Internet Software Consortium DHCP Client 2.0pl5 Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved. Please contribute if you find this software useful. For info, please visit http://www.isc.org/dhcp-contrib.html sit0: unknown hardware address type 776 sit0: unknown hardware address type 776 Listening on LPF/eth0/00:0f:1f:df:4e:39 Sending on LPF/eth0/00:0f:1f:df:4e:39 Sending on Socket/fallback/fallback-net DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7 receive_packet failed on eth0: Network is down DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17 DHCPOFFER from 192.168.1.1 DHCPREQUEST on eth0 to 255.255.255.255 port 67 DHCPACK from 192.168.1.1 bound to 192.168.1.11 -- renewal in 30000 seconds.
Now to verify it's up and working:
# ifconfig eth0 | grep inet inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
Looks good. Time you try to connect somewhere.
Although dhcp is the more popular and easier of the two, you can also specify an IP address using ifconfig. You typically will need to know the NIC and your IP, although you can add subnet and many other options in the Manual if you want a non-standard configuration.
# ifconfig eth0 192.168.1.11
should be as simple as that. Now to verify it's working:
# ifconfig eth0 | grep inet inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
Excellent! The one difference with setting your IP is that dhcpd usually also defines your default gateway. Your gateway is typically the host of your ISP that your internet traffic will go through. Your gateway or router will be one hop away from you. To set a default gateway of 192.168.1.1 you will do the following. Note that many UBOs use a different route command, so you will likely use one of the following three:
# route add default gw 192.168.1.1
# route add default 192.168.1.1
# route add default gateway 192.168.1.1
but really, you're not going to run a command as root without reading the Manual page first to ensure you're using the proper syntax, right?
Finally, we will check our routing:
$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
You should be ready to try to Connect somewhere now.