Editing
0030.html
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<div class="links"> '''Re: [Vserver] routing: 2 different virtual subnets on the same machine:'''<br /> <span class="small">vserver development mailing list</span> <br /> [<nowiki/>[[../|Next/Previous Months]]] [<nowiki/>[http://www.solucorp.qc.ca/miscprj/s_context.hc Main vserver Project Homepage]] [<nowiki/>[http://www.solucorp.qc.ca/mlist/index.hc?list=vserver Howto Subscribe/Unsubscribe]] [<nowiki/>[http://www.paul.sladen.org/vserver/ Paul Sladen's vserver stuff]] </div> <div class="head"> <span id="re-vserver-routing-2-different-virtual-subnets-on-the-same-machine"></span> = Re: [Vserver] routing: 2 different virtual subnets on the same machine = * <span class="dfn">This message</span>: [ [[#start|Message body]] ] [ [[#options2|More options]] ] * <span class="dfn">Related messages</span>: [ [[0031.html|Next message]] ] [ [[0029.html|Previous message]] ] [ [[0029.html|In reply to]] ] [ [[0031.html|Next in thread]] ] </div> <div class="mail"> <span id="from"> <span class="dfn">From</span>: Chuck <[mailto:chuck_at_sbbsnet.net?Subject=Re:%20%5BVserver%5D%20routing:%202%20different%20virtual%20subnets%20on%20the%20same%20machine chuck_at_sbbsnet.net]> </span><br /> <span id="date"><span class="dfn">Date</span>: Fri 06 Apr 2007 - 22:10:02 BST</span><br /> <span id="message-id"><span class="dfn">Message-Id</span>: <200704061710.02513.chuck@sbbsnet.net> </span><br /> ok..<br /> 1. install iproute2on the host. this is the only place it is needed.<br /> 2. on my system the tables are kept in /etc/iproute2<br /> you only have to edit rt_tables<br /> at the bottom of the list that is included by default add 2 tables.<br /> you can call them whatever you want. each table you enter must<br /> have a unique number.<br /> <br /> 192 192net1<br /> 193 192net2<br /> would work fine.<br /> <br /> I don't know how deb handles network configurations but in gentoo we use a<br /> single 'net' file and we tell it what module to use (ifconfig,iproute2,etc).<br /> if you need to, tell your system to use iproute2<br /> since we have a very neat way of configuring the networks in gentoo, i am not<br /> positive about the syntax for the ip program itself but it would be something<br /> similar to :<br /> ip addr add <ip> netmask <netmask> broadcast <broadcast> dev ethx<br /> ip route add <netblock> src <ip> table 192net1 dev eth0<br /> ip route add <netblock> src <ip> table 192net2 dev eth1<br /> ip route add default via <gw ip> table 192net1 dev eth0<br /> ip route add default via <gw ip> table 192net2 dev eth1<br /> ip rule add from 192.168.1.0/24 table 192net1 dev eth0<br /> ip rule add from 192.168.2.0/24 table 192net2 dev eth1<br /> i assigned arbitrary values to the ip addresses below:<br /> our syntax in gentoo would be:<br /> config_eth0=( "192.168.1.34 broadcast 192.168.1.255 netmask 255.255.255.0")<br /> config_eth1=( "192.168.2.60 broadcast 192.168.2.255 netmask 255.255.255.0")<br /> <br /> then the routing table instructions which simply say plug this netblock and<br /> source ip using this ethx into this table<br /> routes_eth0=( "192.168.1.0/24 src 192.168.1.34 table 192net1")<br /> routes_eth1=( "192.168.2.0/24 src 192.168.2.60 table 192net2")<br /> then the gateways for the tables<br /> routes_eth0=( "default via 192.168.1.1 table 192net1" )<br /> routes_eth1=( "default via 192.168.2.1 table 192net2" )<br /> then we add the machine default gateway - note no table reference.. this<br /> handles routing for everything else that doesnt get handled by tables above.<br /> routes_eth0=( "default via 192.168.1.1" )<br /> now we add rules which basically say anything from netblock 'x' use the proper<br /> table<br /> rules_eth0=( "from 192.168.1.0/24 table 192net1")<br /> rules_eth1=( "from 192.168.2.0/24 table 192net2")<br /> hope this isn't too confusing since i am not positive of the actual ip program<br /> syntax ... the gentoo instructions are accurate and so would probably tell<br /> you a bit about everything you need to plug into whatever.. gentoo has<br /> subroutines that read the devices and line after them and plug the proper<br /> values into the ip program syntax.<br /> debian probably has some type of similar network configuration to make it a<br /> reasonable config.<br /> please note that when using iproute2, using ifconfig to display assigned ip<br /> addresses is somewhat innacurate at best. route -n is also somewhat<br /> misleading. the proper way would be<br /> ip addr show<br /> ip route show<br /> ip rule show<br /> hope this helps some. it will definitely cure your problem with multiple<br /> networks on multiple nics. i have had as many as 5 different networks plugged<br /> into 5 nics without an oops at all. it just works.<br /> Chuck<br /> On Friday 06 April 2007 15:21, Konstantinos Pachopoulos wrote:<br /> ''> //''<br /> ''>''<br /> ''> Hi Chuck,''<br /> ''> i am using Debian Etch. Everything could bu useful at this point :)''<br /> ''>''<br /> ''>''<br /> ''> > From: Chuck <chuck_at_sbbsnet.net''<br /> ''> <mailto:chuck_at_sbbsnet.net?Subject=Re:%20%5BVserver%5D%20routing:''<br /> %202%20different%20virtual%20subnets%20on%20the%20same%20machine>><br /> ''>''<br /> ''> > Date: Fri 06 Apr 2007 - 12:48:51 BST''<br /> ''> > Message-Id: <200704060748.52181.chuck@sbbsnet.net>''<br /> ''>''<br /> ''> > On Friday 06 April 2007 06:28, Konstantinos Pachopoulos wrote:''<br /> ''>''<br /> ''> > i ran into the same situation with 4 nics and solved it with iproute2''<br /> ''> on the''<br /> ''> > host. using simple tables and rules i was able to have the machine''<br /> ''> default''<br /> ''> > gateway for eth0 yet route all various subnets through their proper''<br /> ''> nics with''<br /> ''> > their own gateways. what distro are you using for the host? i can only''<br /> ''> give''<br /> ''> > exact specifics for gentoo but i can give you the basic config''<br /> ''> structures you''<br /> ''> > can adapt to other distros. iproute2 was the only way i could get this''<br /> ''> > working properly.''<br /> ''>''<br /> ''> > if interested let me know and i will post a basic structure for your''<br /> ''> setup.''<br /> ''>''<br /> ''> > /> Hi, /''<br /> ''> > /> i have not much knowlege on routing and following other advice or''<br /> ''> trying /''<br /> ''> > /> to follow solutions to similar cases /''<br /> ''> > /> (http://www.freenux.org/~mm/wordpress/?p=10''<br /> ''> <http://www.freenux.org/%7Emm/wordpress/?p=10> for example) didn't work''<br /> ''> for /''<br /> ''> > /> me. So here is the case: /''<br /> ''> > /> -on my virtual box there are guests running in 2 different subnets: /''<br /> ''> > /> 192.168.1.0/24 and 192.168.2.0/24 /''<br /> ''> > /> -192.168.2.0/24 is supposed to be a DMZ. /''<br /> ''> > /> -the virtual box has 2 interfaces: eth0 for routing 192.168.1.0/24''<br /> ''> and /''<br /> ''> > /> eth3 for routing 192.168.2.0/24 /''<br /> ''> > /> /''<br /> ''> > /> /''<br /> ''> > />''<br /> ''> ----------------------------------------------------------------------------------------------''<br /> ''> /''<br /> ''> > /> | vhost3-----vhost4 vhost1-----vhost2 /''<br /> ''> > /> | /''<br /> ''> > /> |__________________________________________________________| /''<br /> ''> > /> | | /''<br /> ''> > /> | 192.168.2.0/24 via eth3 | /''<br /> ''> > /> 192.168.1.0/24 via eth0 /''<br /> ''> > /> | | /''<br /> ''> > /> | | /''<br /> ''> > /> |_________ _______________________| /''<br /> ''> > /> | | /''<br /> ''> > /> router ----> wireless wan / Internet /''<br /> ''> > /> /''<br /> ''> > /> /''<br /> ''> > /> I just want the 192.168.2.0/24 to be routed via eth3 and''<br /> ''> 192.168.1.0/24 /''<br /> ''> > /> via eth0. The router/firewall will take over afterwards. /''<br /> ''> /> Suggestions? /''<br /> ''> > /> _______________________________________________ /''<br /> ''> > /> Vserver mailing list /''<br /> ''> > /> Vserver@list.linux-vserver.org /''<br /> ''> > /> http://list.linux-vserver.org/mailman/listinfo/vserver /''<br /> ''> > /> /''<br /> ''> _______________________________________________''<br /> ''> Vserver mailing list''<br /> ''> Vserver@list.linux-vserver.org''<br /> ''> http://list.linux-vserver.org/mailman/listinfo/vserver''<br /> ''>''<br /> <pre> -- Chuck "...and the hordes of M$*ft users descended upon me in their anger, and asked 'Why do you not get the viruses or the BlueScreensOfDeath or insecure system troubles and slowness or pay through the nose for an OS as *we* do?!!', and I answered...'I use Linux'. " The Book of John, chapter 1, page 1, and end of book _______________________________________________ Vserver mailing list Vserver@list.linux-vserver.org http://list.linux-vserver.org/mailman/listinfo/vserver</pre> <span id="received"><span class="dfn">Received on</span> Fri Apr 6 23:16:38 2007</span> </div> <div class="foot"> * <span class="dfn">This message</span>: [ [[#start|Message body]] ] * <span class="dfn">Next message</span>: [[0031.html|Chuck: "Re: [Vserver] routing: 2 different virtual subnets on the same machine"]] * <span class="dfn">Previous message</span>: [[0029.html|Konstantinos Pachopoulos: "Re: [Vserver] routing: 2 different virtual subnets on the same machine"]] * <span class="dfn">In reply to</span>: [[0029.html|Konstantinos Pachopoulos: "Re: [Vserver] routing: 2 different virtual subnets on the same machine"]] * <span class="dfn">Next in thread</span>: [[0031.html|Chuck: "Re: [Vserver] routing: 2 different virtual subnets on the same machine"]] * <span id="options2"></span><span class="dfn">Contemporary messages sorted</span>: [ [[date.html#30|By Date]] ] [ [[index.html#30|By Thread]] ] [ [[subject.html#30|By Subject]] ] [ [[author.html#30|By Author]] ] [ [[attachment.html|By messages with attachments]] ] </div> <div align="center"> [<nowiki/>[[../|Next/Previous Months]]] [<nowiki/>[http://www.solucorp.qc.ca/miscprj/s_context.hc Main vserver Project Homepage]] [<nowiki/>[http://www.solucorp.qc.ca/mlist/index.hc?list=vserver Howto Subscribe/Unsubscribe]] [<nowiki/>[http://www.paul.sladen.org/vserver/ Paul Sladen's vserver stuff]]<br /> <span class="small">Generated on Fri 06 Apr 2007 - 23:16:41 BST by [http://www.hypermail.org/ hypermail 2.1.8]</span> </div>
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information