cvs commit: hints iproute2.txt
timothy at linuxfromscratch.org
timothy at linuxfromscratch.org
Wed Jul 24 20:01:25 PDT 2002
timothy 02/07/24 20:01:25
Added: . iproute2.txt
Revision Changes Path
LFS VERSION: All kernel 2.2 and later versions
AUTHOR: Marcos Zapata <zeta11 at yahoo.com>
How to compile iproute2 and use it with your LFS.
Most linux distributions are starting to provide the iproute2 package,
because of the new redesigned network subsystem implemented in kernels 2.2 and
up. The old comands 'ifconfig' and 'route' are now been deprecated because of
their faulty and unexpected behaviour under these kernels.
It was written by Alexey Kuznetsov, who also wrote the routing code of the
kernels 2.2 and up. This new routing and filtering code provides many advantages
and features that weren't available before and ip is the tool to handle it.
Where to download it?
For the purposites of this hint, I'll be using:
iproute2-2.4.7-now-ss020116-try.tar.gz and kernel-2.4.18.
The compiling and instalation of this program is very strait-forward:
tar -zxvf iproute2-2.4.7-now-ss020116-try.tar.gz
#if you want, edit Makefile to change some values like KERNEL_INCLUDE or
#SBINDIR. You shouldn't need to if you've built LFS.
If you didn't edit Makefile, the tools should be in /sbin, the conf. files in
/etc/iproute2 and the docs in /usr/doc/iproute2. Sadly, it doesn't include any
man pages, you'll need latex and sgmltools to read the docs. I advised you to
read them, to fully understand and use this powerful tool.
Ok, now that we have ip we need to recompile the kernel. With 'make menuconfig'
under 'Networking options', enable netlink and filtering support, also tunneling
and multicasting. The exact options names may vary for the different kernel
versions. Just make sure you enable netlink support, it needs it. Compile the
bzImage and modules, install, and remember to add this new kernel to your lilo
or grub conf. to start with this new configuration.
If you built LFS 3.1 (I guess it could work with previous versions) you need to
change the boot scripts: localnet and network in /etc/rc.d/init.d.
look for 'loadproc ifconfig lo 127.0.0.1' in start), replace it with:
ip addr add 127.0.0.1/8 dev lo
ip link set lo up
look for 'loadproc ifconfig lo down' in stop), replace it with:
ip link set lo down
ip addr del 127.0.0.1 dev lo
look for 'ifconfig lo' in status), replace it with:
ip addr show lo
look for 'route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF',...:
ip route add default via $GATEWAY scope link metric 1 dev $interface
look for 'route del -net default', replace it with:
ip route del default
Also, the scripts in /etc/sysconfig/network-devices: ipdown and ifup.
look for 'ifconfig $1 down', replace it with:
ip link set $1 down
ip addr del $IP dev $1
look for 'ifconfig $1 $IP netmask $NETMASK broadcast $BROADCAST',....:
ip addr add $IP/$NETMASK broadcast $BROADCAST dev $1
ip link set $1 up
As you can see the ip command is very simple to use, and it's very similar to
ifconfig and route. The only thing that changes is the NETMASK.
You need to change NETMASK in /etc/sysconfig/network-devices/ifconfig.eth* :
from 255.255.255.255 to 32
.. 255.255.255.0 to 24
.. 255.255.0.0 to 16
.. 255.0.0.0 to 8
so that ifconfig.eth0 (for example) looks something like this:
That's it. You can reboot now and start using your LFS with this new tool.
You shouldn't have much trouble setting it up. Good luck.
Thanks to Diego Saravia, for getting me started with iproute2.
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message
More information about the hints