I have my Linux laptop configured (via netcfg) to use a static IP address (assigned to me by my Internet Service Provider). At client sites I usually connect to the Ethernet network and obtain an IP address by querying a Dynamic Host Configuration Protocol (DHCP) server. How? It's frightfully easy.
Gotcha! A typo! Make sure you type that command correctly - there is no dhcpd command, it's spelled dhcpcd. |
1. Issue the dhcpcd command.
# /sbin/dhcpcd
dhcpcd: your IP address = 10.2.199.139
#
That's all there is to it.
I assume of course that your kernel has Ethernet support, you have a Ethernet port on your computer, and an Ethernet device in the /dev directory. I used the dmesg | grep eth command to see what my system had to offer:
eth0: BMAC+ at 00:50:e4:20:7f:78
Once back at home, to stop using DHCP and return to the static IP I configured with netcfg, I shutdown dhcpcd and cycle the networking with these commands (run as the superuser or with sudo):
# dhcpcd -k
# /etc/rc.d/init.d/network stop
# /etc/rc.d/init.d/network start