Performing IPTABLES postrouting on virtual nic interface
Hi,
RHEL3 Update 4 Net-SNMP 5.3.0.1 IPTables 1.2.8 I am attempting to add iptables rules to enable a SNMP trap to appear as though it is from a virtual nic IP address. For example, I have 2 SNMP agents, running on ports 161 (default, using real IP address 192.168.1.10 on eth0) and 163 (second snmpd, using the virtual ip 192.168.1.11 on eth0:1) and I want traps from one to appear to be from a different IP to traps from the other. I have tried the following rules: # iptables -t nat -A POSTROUTING -s 192.168.1.10 -o eth0 -j SNAT --to-source 192.168.1.11 But of course that rewrites every bit of IP traffic The I tried: # iptables -t nat -A POSTROUTING -s 192.168.1.10 -o eth0:1 -j SNAT --to-source 192.168.1.11 But IPtables didn't like the ":" character Next I tried to differentiate on source port, and that required a protocol: # iptables -t nat -A POSTROUTING -s 192.168.1.10 --protocol tcp --source-port 163 \ -j SNAT --to-source 192.168.1.11 # iptables -t nat -A POSTROUTING -s 192.168.1.10 --protocol udp --source-port 163 \ -j SNAT --to-source 192.168.1.11 This had no effect (possibly due to the way SNMP is based on top of existing protocols), so I wanted to base the distinction on source port alone but I cannot do this without specifying a protocol of either TCP or UDP. So does anyone have any ideas as to how I can apply an IP address to this sort of traffic? Many thanks, Jon Daniels |
Quote:
Code:
iptables -P FORWARD DROP |
All times are GMT -5. The time now is 06:11 PM. |