357 lines
8.5 KiB
HTML
357 lines
8.5 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Exploring your current configuration</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Linux Advanced Routing & Traffic Control HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Introduction to iproute2"
|
|
HREF="lartc.iproute2.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Prerequisites"
|
|
HREF="lartc.iproute2.package.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="ARP"
|
|
HREF="lartc.iproute2.arp.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Linux Advanced Routing & Traffic Control HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="lartc.iproute2.package.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 3. Introduction to iproute2</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="lartc.iproute2.arp.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="LARTC.IPROUTE2.EXPLORE"
|
|
></A
|
|
>3.4. Exploring your current configuration</H1
|
|
><P
|
|
>This may come as a surprise, but iproute2 is already configured! The current
|
|
commands <B
|
|
CLASS="COMMAND"
|
|
>ifconfig</B
|
|
> and <B
|
|
CLASS="COMMAND"
|
|
>route</B
|
|
> are already using the advanced
|
|
syscalls, but mostly with very default (ie. boring) settings.</P
|
|
><P
|
|
>The <B
|
|
CLASS="COMMAND"
|
|
>ip</B
|
|
> tool is central, and we'll ask it to display our interfaces
|
|
for us.</P
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN187"
|
|
></A
|
|
>3.4.1. <B
|
|
CLASS="COMMAND"
|
|
>ip</B
|
|
> shows us our links</H2
|
|
><TABLE
|
|
BORDER="1"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>[ahu@home ahu]$ ip link list
|
|
1: lo: <LOOPBACK,UP> mtu 3924 qdisc noqueue
|
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
|
2: dummy: <BROADCAST,NOARP> mtu 1500 qdisc noop
|
|
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
|
|
3: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1400 qdisc pfifo_fast qlen 100
|
|
link/ether 48:54:e8:2a:47:16 brd ff:ff:ff:ff:ff:ff
|
|
4: eth1: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 100
|
|
link/ether 00:e0:4c:39:24:78 brd ff:ff:ff:ff:ff:ff
|
|
3764: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP> mtu 1492 qdisc pfifo_fast qlen 10
|
|
link/ppp </PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>Your mileage may vary, but this is what it shows on my NAT router at
|
|
home. I'll only explain part of the output as not everything is directly
|
|
relevant.</P
|
|
><P
|
|
>We first see the loopback interface. While your computer may function
|
|
somewhat without one, I'd advise against it. The MTU size (Maximum Transfer
|
|
Unit) is 3924 octets, and it is not supposed to queue. Which makes sense
|
|
because the loopback interface is a figment of your kernel's imagination.</P
|
|
><P
|
|
>I'll skip the dummy interface for now, and it may not be present on your
|
|
computer. Then there are my two physical network interfaces, one at the side
|
|
of my cable modem, the other one serves my home ethernet segment.
|
|
Furthermore, we see a ppp0 interface.</P
|
|
><P
|
|
>Note the absence of IP addresses. iproute disconnects the concept of 'links'
|
|
and 'IP addresses'. With IP aliasing, the concept of 'the' IP address had
|
|
become quite irrelevant anyhow. </P
|
|
><P
|
|
>It does show us the MAC addresses though, the hardware identifier of our
|
|
ethernet interfaces.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN196"
|
|
></A
|
|
>3.4.2. <B
|
|
CLASS="COMMAND"
|
|
>ip</B
|
|
> shows us our IP addresses</H2
|
|
><TABLE
|
|
BORDER="1"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>[ahu@home ahu]$ ip address show
|
|
1: lo: <LOOPBACK,UP> mtu 3924 qdisc noqueue
|
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
|
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
|
|
2: dummy: <BROADCAST,NOARP> mtu 1500 qdisc noop
|
|
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
|
|
3: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1400 qdisc pfifo_fast qlen 100
|
|
link/ether 48:54:e8:2a:47:16 brd ff:ff:ff:ff:ff:ff
|
|
inet 10.0.0.1/8 brd 10.255.255.255 scope global eth0
|
|
4: eth1: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 100
|
|
link/ether 00:e0:4c:39:24:78 brd ff:ff:ff:ff:ff:ff
|
|
3764: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP> mtu 1492 qdisc pfifo_fast qlen 10
|
|
link/ppp
|
|
inet 212.64.94.251 peer 212.64.94.1/32 scope global ppp0</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>This contains more information. It shows all our addresses, and to which
|
|
cards they belong. 'inet' stands for Internet (IPv4). There are lots of other
|
|
address families, but these don't concern us right now.</P
|
|
><P
|
|
>Let's examine eth0 somewhat closer. It says that it is related to the inet
|
|
address '10.0.0.1/8'. What does this mean? The /8 stands for the number of
|
|
bits that are in the Network Address. There are 32 bits, so we have 24 bits
|
|
left that are part of our network. The first 8 bits of 10.0.0.1 correspond
|
|
to 10.0.0.0, our Network Address, and our netmask is 255.0.0.0.</P
|
|
><P
|
|
>The other bits are connected to this interface, so 10.250.3.13 is directly
|
|
available on eth0, as is 10.0.0.1 for example. </P
|
|
><P
|
|
>With ppp0, the same concept goes, though the numbers are different. Its
|
|
address is 212.64.94.251, without a subnet mask. This means that we have a
|
|
point-to-point connection and that every address, with the exception of
|
|
212.64.94.251, is remote. There is more information, however. It tells us
|
|
that on the other side of the link there is, yet again, only one address,
|
|
212.64.94.1. The /32 tells us that there are no 'network bits'.</P
|
|
><P
|
|
>It is absolutely vital that you grasp these concepts. Refer to the
|
|
documentation mentioned at the beginning of this HOWTO if you have trouble.</P
|
|
><P
|
|
>You may also note 'qdisc', which stands for Queueing Discipline. This will
|
|
become vital later on. </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN206"
|
|
></A
|
|
>3.4.3. <B
|
|
CLASS="COMMAND"
|
|
>ip</B
|
|
> shows us our routes</H2
|
|
><P
|
|
>Well, we now know how to find 10.x.y.z addresses, and we are able to reach
|
|
212.64.94.1. This is not enough however, so we need instructions on how to
|
|
reach the world. The Internet is available via our ppp connection, and it
|
|
appears that 212.64.94.1 is willing to spread our packets around the
|
|
world, and deliver results back to us.</P
|
|
><TABLE
|
|
BORDER="1"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>[ahu@home ahu]$ ip route show
|
|
212.64.94.1 dev ppp0 proto kernel scope link src 212.64.94.251
|
|
10.0.0.0/8 dev eth0 proto kernel scope link src 10.0.0.1
|
|
127.0.0.0/8 dev lo scope link
|
|
default via 212.64.94.1 dev ppp0 </PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>This is pretty much self explanatory. The first 4 lines of output explicitly
|
|
state what was already implied by <B
|
|
CLASS="COMMAND"
|
|
>ip address show</B
|
|
>, the last line
|
|
tells us that the rest of the world can be found via 212.64.94.1, our
|
|
default gateway. We can see that it is a gateway because of the word
|
|
via, which tells us that we need to send packets to 212.64.94.1, and that it
|
|
will take care of things.</P
|
|
><P
|
|
>For reference, this is what the old <B
|
|
CLASS="COMMAND"
|
|
>route</B
|
|
> utility shows us:</P
|
|
><TABLE
|
|
BORDER="1"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>[ahu@home ahu]$ route -n
|
|
Kernel IP routing table
|
|
Destination Gateway Genmask Flags Metric Ref Use
|
|
Iface
|
|
212.64.94.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
|
|
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0
|
|
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
|
|
0.0.0.0 212.64.94.1 0.0.0.0 UG 0 0 0 ppp0</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="lartc.iproute2.package.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="lartc.iproute2.arp.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Prerequisites</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="lartc.iproute2.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>ARP</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |