<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.3">
</HEAD>
<BODY>
On Sun, 2009-12-13 at 22:59 +0100, paul van der meij wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    I don't think that it makes sense to configure a router with one physical network card. If another PC on the same cable segment tries to reach something it needs a router that has connection with more than the same network cable.<BR>
    <BR>
    greetings, paul<BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    2009/12/13 Adel ESSAFI <<A HREF="mailto:adelessafi@gmail.com">adelessafi@gmail.com</A>>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE>
        Hi list<BR>
        This is the first time I have to configure linux as router.<BR>
        I have a single network card for which I gave to IPs<BR>
        <BR>
        eth0      Link encap:Ethernet  HWaddr 00:11:5B:72:7F:D9  <BR>
                  inet addr:41.231.X.Y  Bcast:41.255.255.255  Mask:255.255.255.0<BR>
                  inet6 addr: fe80::211:5bff:fe72:7fd9/64 Scope:Link<BR>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<BR>
                  RX packets:2595 errors:0 dropped:0 overruns:0 frame:0<BR>
                  TX packets:2295 errors:0 dropped:0 overruns:0 carrier:0<BR>
                  collisions:0 txqueuelen:1000 <BR>
                  RX bytes:1876353 (1.7 MiB)  TX bytes:328059 (320.3 KiB)<BR>
                  Interrupt:21 Base address:0x8000 <BR>
        <BR>
        eth0:1    Link encap:Ethernet  HWaddr 00:11:5B:72:7F:D9  <BR>
                  inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0<BR>
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<BR>
                  Interrupt:21 Base address:0x8000 <BR>
        <BR>
        <BR>
        <BR>
        <BR>
        and this is the default route <BR>
        <BR>
        [root@routeur ~]# route<BR>
        Kernel IP routing table<BR>
        Destination     Gateway         Genmask         Flags Metric Ref    Use Iface<BR>
        41.231.2.0      *               255.255.255.0   U     0      0        0 eth0<BR>
        192.168.10.0    *               255.255.255.0   U     0      0        0 eth0<BR>
        link-local      *               255.255.0.0     U     1002   0        0 eth0<BR>
        default         41.231.2.81     0.0.0.0         UG    0      0        0 eth0<BR>
        <BR>
        <BR>
        The problem now, is when I configure a PC with an IP adress 192.168.10.X  and I put the gateway as 192.168.10.10, I do not succeed to ping any PC. How can I route all the packages from eth0:1 to eth0??<BR>
        <BR>
        <BR>
        note that I have configured the ip forward. <BR>
        <BR>
        echo 1> /proc/sys/net/ipv4/ip_forward<BR>
        <BR>
        Can you help me please.<BR>
        <BR>
        regards<BR>
        <BR>
        <BR>
        <BR>
        <BR>
        <BR>
        -- <BR>
        <A HREF="http://ilovefedora.blogspot.com/">http://ilovefedora.blogspot.com/</A><BR>
        <BR>
        -- <BR>
        <BR>
        PhD candidate in Computer Science<BR>
        Address       <BR>
        BP 108, Bureau de poste Tunis republique <BR>
        1001 Tunis<BR>
        Tunisia<BR>
        tel: +216 97 246 706<BR>
        fax: +216 71 391 166<BR>
        <BR>
    </BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE>
        <BR>
        --<BR>
        fedora-list mailing list<BR>
        <A HREF="mailto:fedora-list@redhat.com">fedora-list@redhat.com</A><BR>
        To unsubscribe: <A HREF="https://www.redhat.com/mailman/listinfo/fedora-list">https://www.redhat.com/mailman/listinfo/fedora-list</A><BR>
        Guidelines: <A HREF="http://fedoraproject.org/wiki/Communicate/MailingListGuidelines">http://fedoraproject.org/wiki/Communicate/MailingListGuidelines</A>
    </BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
<PRE>
-- 
fedora-list mailing list
<A HREF="mailto:fedora-list@redhat.com">fedora-list@redhat.com</A>
To unsubscribe: <A HREF="https://www.redhat.com/mailman/listinfo/fedora-list">https://www.redhat.com/mailman/listinfo/fedora-list</A>
Guidelines: <A HREF="http://fedoraproject.org/wiki/Communicate/MailingListGuidelines">http://fedoraproject.org/wiki/Communicate/MailingListGuidelines</A>
</PRE>
</BLOCKQUOTE>
<BR>
It's called 'router on the stick'. While it can be done on dedicated routers (I saw this done on CISCO, don't know if it can be done on Juniper's) it's hard, but not impossible to be done on linux with iptables.<BR>
<BR>
One problem though is that iptables does not recognize aliases (like eth0:1). However it can see the traffic on eth0:1 but it will appear as generated on the same device as eth0. So, if you know iptables good enough, you can build some iptables rules to redirect the traffic from internal network to internet. As I said, it's hard, but can be done. Just google for 'iptables virtual interfaces'.<BR>
<BR>
OTOH, the short answer is: get yourself a second network card - this will solve your problem.<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
<BR>
Calin<BR>
<BR>
Key fingerprint = 37B8 0DA5 9B2A 8554 FB2B 4145 5DC1 15DD A3EF E857<BR>
<BR>
=================================================<BR>
Anyone who uses the phrase "easy as taking candy from a baby" has never tried taking candy from a baby. -- Robin Hood
</TD>
</TR>
</TABLE>
</BODY>
</HTML>