|
|
Hi, I'm working on the same thing... maybe we can help each other... Here's what I have found... Unless you're doing load balancing on the interfaces, nothing will leave you linux gateway on the non-default interface. According to Chapter 4 of the LARTC the following script should setup routing so that a packet generated with the non-defualt address leaves the gw on that interface. Note: I'm not sure what I'm doing... so there may be errors in the script. Any pointers would be greatly appreciated. #!/bin/bash IF1=eth0 IP1=10.0.0.219 P1_NET=10.0.0.0 P1=10.0.0.254 IF2=eth2 IP2=10.2.0.188 P2_NET=10.2.0.0 P2=10.2.0.1 if ! grep ADSL /etc/iproute2/rt_tables >/dev/null ; then echo 200 ADSL >> /etc/iproute2/rt_tables; fi ip route add $P1_NET dev $IF1 src $IP1 table ADSL ip route add default via $P1 table ADSL ip route add $P1_NET dev $IF1 src $IP1 if ! grep CABL /etc/iproute2/rt_tables >/dev/null ; then echo 201 CABL >> /etc/iproute2/rt_tables; fi ip route add $P2_NET dev $IF2 src $IP2 table CABL ip route add default via $P2 table CABL ip route add $P2_NET dev $IF2 src $IP2 ip route add default via $P1 ip rule add from $IP1 table ADSL ip rule add from $IP2 table CABL Then add the local parameter to the openvpn config file. -- Milton Calnek mcalnek@xxxxxxxxxx +1 306 359 6939 -----Original Message----- From: Remus [mailto:rmocius@xxxxxxxxxxxxxx] Sent: Wednesday, April 06, 2005 7:48 AM To: Wang Jian Cc: lartc@xxxxxxxxxxxxxxx; openvpn-users@xxxxxxxxxxxxxxxxxxxxx Subject: [Openvpn-users] Re: [LARTC] UDP port 1194 marking/routing problem Wang, That solution does not suite me: >ip route add default via $DEFAULTGW dev eth1 >ip route add xxx.xxx.xxx.xxx/32 via $ANOTHERGW dev eth0 Because only UPD 1194 has to be routed via eth0 to OpenVPN server IP, everything else to same Ip has to go via eth1. Any ideas? Regards Remus ----- Original Message ----- From: "Wang Jian" <lark@xxxxxxxxxxxx> To: "Remus" <rmocius@xxxxxxxxxxxxxx> Cc: <lartc@xxxxxxxxxxxxxxx>; <openvpn-users@xxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, April 06, 2005 1:38 PM Subject: Re: [Openvpn-users] Re: [LARTC] UDP port 1194 marking/routing problem > Hi Remus, > > I means: don't use policy routing, because you can use much simpler > solution. > > Example: > > ip route add default via $DEFAULTGW dev eth1 > ip route add xxx.xxx.xxx.xxx/32 via $ANOTHERGW dev eth0 > > The second, send all your traffic to IP xxx.xxx.xxx.xxx via eth0. When > your box acts as your intranet's gateway, you can SNAT or MASQUERADE on > eth0, like > > iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE. > > > For you openvpn configuration, you can either bind openvpn to eth0's ip, > or let system chooose the IP, in most case the output interface. > > > On Wed, 6 Apr 2005 12:54:53 +0100, "Remus" <rmocius@xxxxxxxxxxxxxx> wrote: > >> Hi Wang, >> >> We specialy got two Internet connections, one is only for the OpenVPN (it >> is >> heavily used) and second for everthing else. >> I will give a try to PREROUTING stuff right away. >> >> What do mean : But I don't think you need to use MARK to do policy >> routing. >> It's a little overkill. >> >> Do you another suggestion than iptables/MARK? >> >> Regards >> >> Remus >> >> >> ----- Original Message ----- >> From: "Wang Jian" <lark@xxxxxxxxxxxx> >> To: <lartc@xxxxxxxxxxxxxxx> >> Cc: "Remus" <rmocius@xxxxxxxxxxxxxx>; >> <openvpn-users@xxxxxxxxxxxxxxxxxxxxx> >> Sent: Wednesday, April 06, 2005 12:23 PM >> Subject: [Openvpn-users] Re: [LARTC] UDP port 1194 marking/routing >> problem >> >> >> > Hi Remus, >> > >> > It seems that >> > >> > iptables -t mangle -A POSTROUTING -o eth0 -p udp --dport 1194 -j MARK \ >> > --set-mark 0x990 >> > >> > will not take effect. (didn't you typo -A as -D?) >> > >> > POSTROUTING is looked up after routing decision is made. Because the >> > default route is dev eth1, the output device is eth1, -o eth0 will not >> > match. >> > >> > You should use >> > >> > iptables -t mangle -A PREROUTING -p udp --destination <your openvpn \ >> > peer> --dport 1194 -j MARK .... >> > >> > But I don't think you need to use MARK to do policy routing. It's a >> > little overkill. >> > >> > Why not simply route all traffic to your openvpn peer via device eth0? >> > >> > >> > On Wed, 6 Apr 2005 11:51:16 +0100, "Remus" <rmocius@xxxxxxxxxxxxxx> >> > wrote: >> > >> >> >> >> Hi folks, >> >> >> >> I have OpenVPN (respect for it developers) running on my FW. >> >> Is has two external NICs and on internal everything is fine, except >> >> I want OpenVPN (UDP port 1194) going not via default route/network >> >> interface. >> >> >> >> I use such commands: >> >> >> >> iptables -t mangle -D POSTROUTING -o eth0 -p udp --dport 1194 -j >> >> MARK --set-mark 0x990 >> >> ip rule add fwmark 0x990 table openvpn1 >> >> ip route add default via $P2 dev eth0 table openvpn1 >> >> >> >> eth0 is FW's not default external NIC. >> >> >> >> I have in use very similar iptables rules for my email server (TCP >> >> ports) >> >> and etc. >> >> Everything works fine. >> >> What I'm doing wrong with marking/routing the UDP port? >> >> >> >> Regards >> >> >> >> Remus >> >> >> > >> > >> > >> > -- >> > lark >> > >> > >> > >> > ------------------------------------------------------- >> > SF email is sponsored by - The IT Product Guide >> > Read honest & candid reviews on hundreds of IT Products from real >> > users. >> > Discover which products truly live up to the hype. Start reading now. >> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> > _______________________________________________ >> > Openvpn-users mailing list >> > Openvpn-users@xxxxxxxxxxxxxxxxxxxxx >> > https://lists.sourceforge.net/lists/listinfo/openvpn-users >> > >> > >> >> >> _______________________________________________ >> LARTC mailing list >> LARTC@xxxxxxxxxxxxxxx >> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > > > > -- > lark > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Openvpn-users mailing list > Openvpn-users@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/openvpn-users > > ____________________________________________ Openvpn-users mailing list Openvpn-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/openvpn-users -- DISCLAIMER: The information transmitted is intended only for the addressee and may contain confidential, proprietary and/or privileged material. Any unauthorized review, distribution or other use of or the taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete or destroy this message and any copies. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support. ____________________________________________ Openvpn-users mailing list Openvpn-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/openvpn-users Warning: require_once(../../../archive_common.php) [function.require-once]: failed to open stream: No such file or directory in /home/openvpn/domains/openvpn.net/public_html/archive/openvpn-users/2005-04/msg00082.html on line 446 Fatal error: require_once() [function.require]: Failed opening required '../../../archive_common.php' (include_path='/usr/local/lib/php') in /home/openvpn/domains/openvpn.net/public_html/archive/openvpn-users/2005-04/msg00082.html on line 446 |