routing C class with route2
Here's the situation.
My ISP routes all C class to specific IP ( that IP is from another class) and I got cisco router who has that IP on whitch all C class is routed. On the other port of the cisco router all IPs of this C class are awaliable. Some poor attempt to graphicaly show you..
ISP's routing.
C class -> some.ip.198
99.some.ip.198 ->binded at || CISCO || at binded<- C.class.ip.1
So the router just makes the whole C class awaliable ((that it gets on 99.some.ip.198)) out his other port with ip C.class.ip.1.
Can this be done on linux using only (route2) ip tool? Without iptables.
I'm thinking something like
ip addr add 99.some.ip.198/32 dev eth0 (eth0 is the interface on witch the IPs come in - the whole class)
ip addr add C.class.ip.1/22 dev eth1
ip route add 99.some.ip.gateway
I hope you understood this mess and can help me a bit.
Tnx.
-Martin
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Martin,
I am guessing that you are asking:
Can an IP in a subnet defined on one interface can be used on a separate interface on the same linux box?
The short answer is yes.
: ip addr add 99.some.ip.198/32 dev eth0 (eth0 is the interface on witch : the IPs come in - the whole class) ip addr add C.class.ip.1/22 dev eth1 : ip route add 99.some.ip.gateway
If the IPs for the entire class C are available on locally connected networks:
# ip addr add 99.xx.xx.198/32 dev eth0 # -- for your own IP address # ip route add yy.yy.yy.yy/32 dev eth0 # -- your ISPs router # ip addr add 99.xx.xx.1/24 dev eth1 # -- for your internal network
If the IPs for the class C are available via some internal router:
# ip addr add 99.xx.xx.198/32 dev eth0 # -- for your own IP address # ip route add yy.yy.yy.yy/32 dev eth0 # -- your ISPs router # ip addr add zz.zz.zz.zz/?? dev eth1 # -- for your internal network # ip route add 99.xx.xx.0/24 via zz.zz.zz.zz
But, I'm not sure I completely understood your attempt to describe your network.
You may find it handy to read up on route selection in my document. The quick and dirty rule is that the most specific route is always selected first.
http://linux-ip.net/html/routing-selection.html
(formerly http://plorf.net/linux-ip/)
-Martin
Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected] _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/