Hi James,

My one cent (and change :).

- General:
Description of a SIMPLE (not scripted) network connection.
Once you are successful with the simple set-up you can get as
complicated as you like later.
You also have a better chance to understand what the scripts do.

- Author's profile:
1. Simple, unsophisticated, country boy.
2. Likes to control when he is up and down.
 NOT in sync with the machine being up and down.
 If he wants to be in sync with the machine he uses Windows
 (for real work, like we all), which does an "automatic"
 DHCP behind the scenes (in a way like what our regular scripts do).
3. Paranoic about id-theft (the less time on line the better).

- Requirements:
1. Router connected (directly - or through a "modem") to DSL line
2. Router set up as DHCP server (~ default) ready to hand over a
 temporary address to a DHCP client if asked:

 PC --- Ethernet connection (eth0) --- Router --- DSL (Internet)

 Note: The router (basic) set up is not covered here and assumed OK.

3. NOT needed (for my simple set-up)
[]$ cat /etc/sysconfig/network
 HOSTNAME=......

[]$ cat /etc/sysconfig/network-devices/ifconfig.eth0/dhcpcd
 ONBOOT="no"
 SERVICE="dhcpcd"
 DHCP_START="-L"
 DHCP_STOP="-k"
 PRINTIP="yes"
 # PRINTALL="yes" requires PRINTIP="yes".
 # print the DHCP assigned values: IP, SM, DG, and 1st NS
 PRINTALL="yes

[]$ cat /etc/sysconfig/network-devices/services/dhcpcd
 a pretty complicated script ... (luckily, not needed here)

4. NEEDED
[]$ man dhcpcd
[]$ man dhcpcd.conf

[]$ cat /etc/dhcpcd/dhcpcd.conf
 hostname
 option domain_name_servers, domain_name, domain_search, host_name
 option classless_static_routes
 option ntp_servers
 option interface_mtu
 require dhcp_server_identifier
 nohook lookup-hostname

NOTE: In 3. above, "NOT needed" means the related scripts/files on
boot up and shut down should be disabled (/etc/rc.d/...).
BTW: There's no "hostname" involved here. That may feel a little
unsettling I understand, so you can stop reading right here.
Also, I've been using BLFS "dhcpcd-5.2.12" (as a client)
all this time (easy to install, set-up and use).

If still intrigued, continue.
---------------------------------------------------------
Let's get to work. Boot up to command mode directly.
Like in the old days. '/etc/inittab', level 3

[]$ ifconfig eth0
 eth0  Link encap:Ethernet HWaddr ..........
 BROADCAST MULTICAST MTU:1500 Metric:1
 RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

# Start up daemon
[]$ /usr/sbin/dhcpcd eth0 -L
dhcpcd[995]: version 5.2.12 starting
dhcpcd[995]: eth0: broadcasting for a lease
dhcpcd[995]: eth0: offered <my_address> from <server_address>
dhcpcd[995]: eth0: acknowledged <my_address> from <server_address>
dhcpcd[995]: eth0: checking for <my_address>
dhcpcd[995]: eth0: leased <my_address> for 86400 seconds
dhcpcd[995]: forked to background, child pid 1027

Note: <addresses> are as expected, in xxx.xxx.xxx.xxx form

# See if indeed the connection is up (can also be 'ping' or something else)
[]$ ntpd -q && date
 ntpd: time slew +0.049244s
 Sat Mar 31 19:43:14 EDT 2012

# See what 'eth0' looks like now
[]$ ifconfig eth0
eth0  Link encap:Ethernet HWaddr ..........
 inet addr:"IPADDR" Bcast:"BROADCAST" Mask:"NETMASK"
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:156 errors:0 dropped:0 overruns:0 frame:0
 TX packets:190 errors:0 dropped:0 overruns:0 carrier:1
 collisions:0 txqueuelen:1000
 RX bytes:17521 (17.1 Kb) TX bytes:18812 (18.3 Kb)

where above, the daemon plugs in the "IPADDR", "BROADCAST" and "NETMASK"
actual values, found also in the currently created
'/var/lib/dhcpcd/dhcpcd-eth0.info' text file.

# Just for the heck of it
[]$ find /var/run/ -name dhcp*.pid
 /var/run/dhcpcd-eth0.pid
[]$ cat /var/run/dhcpcd-eth0.pid
 1027
[]$ ps ax | grep 1027
 1027 ? Ss 0:00 /usr/sbin/dhcpcd eth0 -L

# Bring down the daemon. We're done experimenting and looked good.
[]$ /usr/sbin/dhcpcd eth0 -k
 dhcpcd[1032]: sending signal 1 to pid 1027
 dhcpcd[1032]: waiting for pid 1027 to exit

[]$ ifconfig eth0
 eth0  Link encap:Ethernet HWaddr ..........
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:279 errors:0 dropped:1 overruns:0 frame:0
 TX packets:201 errors:0 dropped:0 overruns:0 carrier:1
 collisions:0 txqueuelen:1000
 RX bytes:31883 (31.1 Kb) TX bytes:20650 (20.1 Kb)

NOTE: On installation, dhcpcd creates a directory 'dhcpcd' in '/lib'
with lots of goodies (some called "hooks"). Hit the manuals, again.

Good luck,
-- Alex
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to