Sponsored Content
Special Forums IP Networking How to route packets back to incoming interface? Post 302993373 by flyingwalrus on Thursday 9th of March 2017 08:46:03 AM
Old 03-09-2017
Quote:
Originally Posted by jim mcnamara
I don't quite get what you are trying to do. Maybe you want TAP - bridge from eth1: to eth0: Which you not have now. In other words segregate and bridge on this server. Is this box in the DMZ?
Mmmh. Ok let me try to eplain it...

The server hast 1 NIC (eth0) and is connected to the internet. There are several daemons running on it (Apache, FTP, ...). Now from time to time a script running on the machine has to connect by openvpn to some other servers of which I know only the domain name not the ip addresses because they change they rotate ips due load balancing and also have alot of IP ranges.

Now when script opens up a openvpn link (tun0) to connect to a openvpn host, all traffic of my server is then routed over the tun0 gateway. Therefor if some client tries to reach the Apache daemon under it's common address, he get's no reponse, because the reponse packet are not sent back on the eth0 interface but the tun0 route. So no more connection to the daemons are possible anymore until the openvpn connection is closed.

What I want now, is that the server responds to any ip packet it gets, on the same interface it was received. When the vpn link is up, all outgoing packets of tcp/udp traffic which were initiated by the server itself have to be routed to tun0, all answers on incoming packets on eth0 have to be answered to eth0.

Does this make any sense to you? Smilie
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

~ IPTables : Limit Incoming UDP Packets With a Certain Length ~

Hello, I am currently trying to limit incoming UDP length 20 packets on a per IP basis to 5 a second using IPTables on a Linux machine (CentOS 5.2). Basically, if an IP is sending more than 5 length 20 UDP packet a second to the local machine, I would like the machine to drop the excess... (1 Reply)
Discussion started by: tomboy123
1 Replies

2. Solaris

Had to bounce interface to add network route

Hi All, yesterday I was trying to add a network route to my solaris 8 host using 'route add'. Everytime I tried, I kept getting the response 'network is unreachable'. I was trying all kinds of different methods, however I eventually got it to work after bouncing the interface that I was... (2 Replies)
Discussion started by: badoshi
2 Replies

3. Solaris

Route new network interface Solaris 8

Hi there, I'm trying to configure an additional network interface on Solaris 8 (eri0). The interface has been activated, but all the frames are still routed to the current default interface (ce0) I've tried following command (with various syntaxes...) unsuccessfully so far: # route add... (2 Replies)
Discussion started by: sreiniche
2 Replies

4. UNIX for Dummies Questions & Answers

Linux box drops the incoming packets

Hi all, I am new to Linux kernel. we have a c file that counts the no. of sends and received packets in each interface, and indicate the user about the error/drop ration of incoming and outgoing packets. in our Linux box , the incoming packets are dropped at random interval. we have our... (1 Reply)
Discussion started by: kannandv
1 Replies

5. Solaris

Network interface down after adding static route

Please , I have a problem I have add a statis route on Solaris 10, but after this, the network interface of Server was Offline. The system is in cluster mode (3.2) route add -net 10.10.1.128 -netmask 255.255.255.128 10.10.1.51 ------------------- lo0:... (1 Reply)
Discussion started by: Ruggero
1 Replies

6. Solaris

route and interface configuration in solaris

Hi, Every time when i boot my system i have to manually issue the following commands. ifconfig elxl0 plumb 192.168.200.129 netmask 255.255.255.0 up route add default 192.168.200.1 I need some help so that it should be configured permanently and i wouldn't have to manually issue... (2 Replies)
Discussion started by: malikshahid85
2 Replies

7. IP Networking

how to hack linux driver to delay incoming packets

hello, can anyone suggest how to delay the incoming packets ?? or how the packets are prossed inside the kernal and a way to make the packets wait a while?? it wud be vry helpful regards sameer (7 Replies)
Discussion started by: sameer kulkarni
7 Replies

8. Linux

how to allow incoming UDP packets with iptables

I am looking for an iptables command to allow incoming UDP packets for my Linux server also is there a command I can use to set the default action for outgoing packets to accept? Thank you (1 Reply)
Discussion started by: crimputt
1 Replies

9. IP Networking

Route packets over specified interface

Hi, I'm quite new to unix networking and ip tables. I'm running a debian (htpc) server with two NIC's; eth0 and wlan0. I'm trying to set it up in a way that eth0 is the default interface for internet, but some processes should run through wlan0. For example, I'm using eth0 for downloads... (2 Replies)
Discussion started by: Subbeh
2 Replies

10. IP Networking

How to route all incoming packets from one virtual interface?

Hello, I'm trying to route all packets arriving at a particular interface by entering the same interface the virtual interface eth1: 2 and now everything is routed by default gw configured on eth1. eth1 Link encap:Ethernet HWaddr 0a:0e:64:18:52:72 inet addr:192.168.10.15 eth1:2 ... (1 Reply)
Discussion started by: faka
1 Replies
FILTER 
SYNTAX(5) File Formats Manual FILTER SYNTAX(5) NAME
rules.filter - Input format for filtergen packet filter compiler INTRO
This file describes the input syntax accepted by filtergen(8). BASICS
In general form, a filter rule is described by a direction, an interface, a target and (possibly empty) sets of matches and options. Simple rules will look like: direction interface match0 .. matchN target; for example: input eth0 source host1 dest host2 proto tcp dport http accept; Note that the elements of the rule can be placed in any order, with the exception that the interface must immediately follow the direction. Thus, this rule is equivalent to the above (though perhaps less readable): proto tcp source host1 dport http accept dest host2 input eth0; The semicolon separates rules. It is optional before a closing brace or the end of a file. Whitespace is not significant. Anything after a hash ("#") on a line is ignored. DIRECTION A direction merely specifies whether to match packets being sent or received. The only two directions available are "input" and "output". Forwarded packets will pass through both, INTERFACE This specifies which real or virtual network device to filter. As far as filtergen is concerned, this is just a text string. It must be the same as the device name on the target system. Common names on Linux are "eth0", "eth1", ..., "ppp0", etc. Other systems will have different naming rules. TARGET A target notes what we do with a matching packet. Universal options are accept and drop which, respectively, state that the packet should be allowed as normal, or thrown away. Some backends support reject to throw away a packet, but send notification to the sender that it was denied, masq (on output rules only) to "masquerade" a packet - alter it so that it appears to come from the address of the sending inter- face - and proxy (and its deprecated alias redirect) to divert a connection via the local system. MATCHES The matches are the meat of the rule. They apply a set of tests to a packet and decide if this rule will be used to process it. Available matches are: source addr-range dest addr-range proto {tcp|udp|icmp|...} sport port-range dport port-range icmptype icmp-type Matches can be negated by prefixing them with a "!": input eth0 ! dest 10.0.0.3 reject; (note than not all backends can support this). OPTIONS Options affect the behaviour of the matcher or the target. Currently implemented are log, which logs packets, local, which means only to check packets to or from this interface, forward which means the opposite of local, and oneway which causes the backend to omit rules which permit return packets. The log option can optionally specify a message to log matching packets with, where the backend supports it: input eth0 source { 10.0.0.0/8 192.168.0.0/16 } log text "private addresses" drop; Note that the oneway option make have no effect when used with the -l command-line flag on backends which support it. GROUPING
Because it can get tedious to type: input eth0 source foo dest bar proto tcp dport http accept; input eth0 source foo dest bar proto tcp dport https accept; input eth0 source foo dest bar proto tcp dport nntp accept; input eth0 source foo dest bar proto tcp sport 1:1023 dport ssh accept; ... filter allows you to group rules with a set syntax: input eth0 source foo dest bar proto tcp { dport http; dport https; dport nntp; sport 1:1023 dport ssh; } accept; Matches which accept arguments can also be grouped: input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; OUT-OF-LINE GROUPS It is commonly the case that both hosts and routers have long lists of similar looking rules to allow traffic between groups of hosts, as above. What if we had another pair of hosts which needed a variety of services? We could simply put the rule groups one after the other: input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; input eth0 source baz dest quux proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; The above generates 11 rules, and every additional port adds another rule through which packets will pass (well, ones which don't match any of the above). The first four output rules have the same source and destination hosts and protocol, and we know that if it doesn't match those on the first rule, it won't on the next three, either. Out-of-line groups use this fact to streamline things somewhat: input eth0 source foo dest bar [ proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; Where the underlying system supports it, everything inside the square brackets is moved into a separate "chain" (in ipchains and iptables- speak) or "group" (in ipfilter-speak). Thus, any packet not matching "source foo dest bar" or "source baz dest quux" above will be checked against only two rules, not eleven. Note that matches which must appear together, like "proto tcp" and "sport 12345" need to be either both in the group, or both out of it. EXAMPLE
Here's a fairly complete example, for a single-interface machine: # # Example filter for (for example) a mail server # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { # Sadly, we share a DMZ with Windows machines. # Don't log their netbios noise proto {tcp udp} source ournet/24 dport 137:139 drop; proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; SEE ALSO
filtergen(8), filter_backends(7) January 7, 2004 FILTER SYNTAX(5)
All times are GMT -4. The time now is 11:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy