(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

9. Set up networking

In this chapter we will set up TCP/IP networking on the integrated ethernet adapter

9.1. Support for the integrated ethernet adapter

The 7248-133 is equipped with an internal AMD PCnet 32 PCI ethernet adapter. There is support for this adapter in the Linux kernel source, and if you installed from my bootimage, you should have support for it in your kernel already. Otherwise, you can compile a new kernel. The bootimage described in Section 5 has support for the adapter too.

9.2. Configuration files

The configuration files to set up TCP/IP-networking over ethernet on this box is the same manual configuration as on any other RedHat-like Linux box elsewhere, but here, we do it manually, without any tools other than your favourite text editor. This only covers basic installation, and NO EXTRA SECURITY AT ALL. There are plenty of other, and much better sources about this topic than I can put up here. The files to edit are found in the /etc directory and its subdirectories. To edit the files, you should be logged in as root.

9.3. Set IP address and netmask

To set the IP address and netmask, make a file

        /etc/sysconfig/network-scripts/ifcfg-eth0
        
That looks like this:
        DEVICE="eth0"
        ONBOOT="yes"
        IPADDR="111.122.133.144"
        NETMASK="255.255.255.0"
        
Of course, replace the numbers in the IPADDR and NETMASK fields with the ones you should use. If you don't know, ask your system administrator.

9.4. Set hostname and gateway

To set the hostname and gateway, edit the file

        /etc/sysconfig/network
        
so it looks like this:
        NETWORKING=yes
        FORWARD_IPV4="yes"
        HOSTNAME=myhost.mydomain
        GATEWAY="122.133.144.155"
        
Of course, replace the values in the HOSTNAME and GATEWAY fields with the ones you should use. If you don't know, ask your system administrator.

9.5. Nameserver specification

To specify a nameserver, edit the file

        /etc/resolv.conf
        
so it looks like this:
        search mydomain
        nameserver 133.144.155.166
        
Of course, replace the values in the search and nameserver fields with the ones you should use. If you don't know, ask your system administrator.

9.6. The hosts file

Finally, edit the the file

        /etc/hosts
        
so it looks like this:
        127.0.0.1       localhost       localhost.localdomain
        111.122.133.144 myhost.mydomain myhost loghost
        
The last line should suit the values you added previously as the system's IP-address and hostname.

9.7. Restart the network

This should be everything you need to get started. Now restart networking with the command

        /etc/rc.d/init.d/network restart
        

And you should be all up. Note that there is a bug somewhere that makes the netcard freeze the whole system when shutting down eth0. According to Martin Espenschied, this is a known issue, and can be fixed. When I know how, I'll put the information here. Till then, remember to sync your system before shutting down, and you should not miss any information. Remember my disclaimer in Section 1.2 though.

An ugly hack to resolve this might just be to NOT to shut down eth0 at shutdown/reboot. This can be done by editing the file /etc/rc.d/init.d/network, and in the stop) case, just comment away the ifdown command, and add a phoney command, like this:

        action "Shutting down interface $i" echo does_nothing # ./ifdown $i boot
        
Note that this is a rather ugly hack, that won't actually solve the problem, it just hides it. The network won't go properly down until you reboot the machine. This is actually the "stupid Windows" way. I really hope that somebody have a better fix on this later. Thanks to Doc Shipley for this tip.