[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Post-installation: how to auto-configure network adapter (ie. enable internet access)?



Horatio Leragon wrote:
> What do you think of the following method? (I found it on Google today). Your feedback would be appreciated.
> ...
>     dmesg | grep -i Eth
> and next strings should appear:
>     8139too Fast Ethernet driver 0.9.28
>     eth0: RealTek RTL8139 at 0xdf822c00, 00:15:f2:51:ad:da, IRQ 21
>     eth0: Identified 8139 chip type 'RTL-8101'

That assumes you have that hardware.  Other hardware will show up with
their own id strings.

> ...
>     auto eth0

Better to use "allow-hotplug" there instead of "auto".

>     iface eth0 inet dhcp
> ...
> Similarly, network interface can be configured via command line:
> 
>     #dhcpcd eth0

There isn't a "dhcpcd" command in Debian.  You must be using a
different system with the above notes.

If you are using /etc/network/interfaces then you really should use
"ifup" and "ifdown" for this purpose.  Which means instead of the
above use:

  # ifdown eth0

  # ifup eth0

> For this, you should install in Debian aptitude install dhcp3-client.

On Debian that would be "isc-dhcp-client".

> If you don't configure DNS, you cannot connect to any Internet
> resource by it's name.

That is only true if you are using static IP assignment.  If you use
static IP assignment then you must fully configure the system
yourself.  I like the resolvconf package and then configuring it in
/etc/network/interfaces too using "dns-nameservers".

If you use DHCP then it will configure /etc/resolv.conf for you
automatically.  That is rather the entire point of DHCP (Dynamic Host
Configuration Protocol) in that it will dynamically configure the
host.

> But it's very simple to tweak it: just edit or create file
> /etc/resolv.conf
> 
>     # nano /etc/resolv.conf
>     or
>     sudo nano /etc/resolv.conf
> 
> And type addresses like this:
> 
>     nameserver   192.168.1.1
>     nameserver   192.168.2.1
> 
> as much as it is need.

Please let the file be managed by DHCP.  It is simpler.

> The word nameserver is required.

Strictly speaking no.  Although that is the major use of it.  See the
documentation for details.

  man resolv.conf

> It is curious, but in fresh Debian installation there is no
> resolv.conf...

Only if there is no networking configured.  If you don't configure
networking then you don't need /etc/resolv.conf.  If you do such as
through DHCP then it will be set up for you automatically.

> For changes to take place immediately...
> 
> ... one can reboot the system, or type:
> 
>     # /etc/init.d/networking restart 
>     or
>     sudo /etc/init.d/networking restart 

With the addition of "service" it closes some linger potential
problems using the /etc/init.d/foo path from the command line.  Such
as cleaning the environment so that your personal environment does not
affect the process environment.  It makes for a nice safety net making
things slightly more reliable.  Instead of the above use:

  # service networking restart

However that is the old way and only applies with the use of "auto".
But so much has moved to the event driven hotplugged system that I
recommend you use "allow-hotplug" instead of "auto" as the event
driven side of things is much better tested these days.  In which case:

  # ifdown eth0

  # ifup eth0

Here is some documentation from the Debian Reference concerning this:

  https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_basic_network_configuration_with_ifupdown_legacy

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: