Re: Help: script for configuring ethernet
I have just installed an ethernet card. I am looking for the script
that help setting up all the addresses (IP address, netmak, gateway..)
I remember using that script some time ago, but then I only setup
Short answer: The main file is /etc/init.d/network.
Remember that all your postinstall scripts are in /var/lib/dpkg/info.
But, on many systems (including Debian), you will be changing the
following files, or similar files:
/etc/gateways: File listing your default gateways.
[Hey, what uses this file?]
Debian has the format in comments.
/etc/hostname: Your hostname, without a domain. Used during bootup
/etc/hosts: Hosts you want to recognize automatically. You should
be sure to include yourself, loopback (127.0.0.1), and
I will normally put my DNS server and gateway in
there. It is ill-advised to put more than that in
because if they change, you'll be left with an old IP
address. The format is as follows: one IP per line,
followed by whitespace, followed by the name of the
server, then a whitespace-separated list of aliases.
Mine looks like:
127.0.0.1 localhost loopback
192.168.13.1 detlev.webstar.net detlev
22.214.171.124 dns.webstar.net dns
126.96.36.199 nkn-webstar.nkn.net nkn
/etc/inetd.conf: This should be set up right. Just make sure.
/etc/mailname: Your fully-qualified hostname, such as
/etc/networks: A list o' networks you will typically use and don't
want to have to look up. It's like hosts. Normally
you don't need this.
/etc/protocols: Just make sure it's set up right.
/etc/resolv.conf: This is a biggie. You need your domain, the
search order of domains above you, and your DNS
server(s), as provided by your network admin. For
search research.c3.com c3.com
/etc/services: Just make sure it's set up right.
/etc/init.d/network: This is the big one. This may be in different
places on different Unixes, but this is Debian. You
need to add the routing tables and whatnot for your
system. Here's mine:
# network: establish the network connection.
# Based on Id: network,v 1.1 1995/02/19 20:29:29 imurdock Exp
# Configure the loopback device.
ifconfig lo 127.0.0.1
route add -net 127.0.0.0
# Configure the ethernet device.
# Note that this is currently configured to be networked to
# machines in the class C net of 192.168.13 (piqnet); not the class B
# subnet set forth by the RFC. This also allows me to use c3net (192.168.195.0)
# as I may need to in the future.
ifconfig eth0 192.168.13.1 netmask 255.255.255.0 broadcast 192.168.13.255
route add -net piqnet gw 192.168.13.1 dev eth0
# Multicasting... Currently goes to the default.
# route add 188.8.131.52 netmask 240.0.0.0 dev eth0
# Note that there is no default route. This is so that a
# default route can be added on demand by services that
# connect me to the Internet (eg PPP).
Look in there for your information. Your milage may
vary, but this is the basic idea; see route(8) and
ifconfig(8) for details. In general, for each net
device you need to do the following:
ifconfig <interface> <address> netmask <netmask> broadcast <broadcast>
route add -net <network> gw <gateway> metric <metric> netmask \
<netmask> dev <interface>
where <interface> is the name of the device, such as
eth0 (note that Linux no longer has /dev/eth0 et al),
<address> is the IP address to be used for that
interface, and <metric>, <netmask>, <broadcast>, and
<gateway> are as assigned by your net admin. If
you're not sure about them, then skip them (and the
associated keyword!) as route and ifconfig are
generally good about finding them out by default.
Also, if you want to use a particular device (such as
your ethernet card) as the default device (you
probably do), then somewhere in the file add
route add default <interface>
Also, don't forget to enable networking in your kernel, and make sure
that netbase and netstd are installed. If they aren't, they'll
configure everything for you.
You may also want to see the applicable HOWTOs.
General public question: Should I refine this into a general document
-=<[Joel Ray "Piquan" Holveck]>=-