November 23, 2024, 01:32:14 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: NAT Questions Im missing something simple  (Read 4882 times)

Offline jccurtis

  • New Member
  • Posts: 1
NAT Questions Im missing something simple
« on: January 04, 2006, 03:05:25 PM »
Okay I am totally new to IPTables and networking in Linux. I have a linux box hooked to my network and want to change the source and destination address of certain packets for VOIP purposes. All I have done so far is created a script for IPTables and activated it, but it doesnt seem to do anything. Here is my script as follows:

#!/bin/bash


iptables -t filter --flush
iptables -t nat --flush
iptables -t mangle --flush

iptables -t filter --delete-chain
iptables -t nat --delete-chain
iptables -t mangle --delete-chain

iptables --policy INPUT DROP
iptables --policy OUTPUT DROP
iptables --policy FORWARD DROP
iptables -t nat --policy POSTROUTING ACCEPT
iptables -t nat --policy PREROUTING ACCEPT

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

iptables -F PREROUTING
iptables -A POSTROUTING -p all -s 10.22.92.111 -o eth0 -j SNAT --to 172.24.9.211
iptables -A PREROUTING -p all -d 172.24.9.211 -i eth0 -j DNAT --to 10.22.92.111

service iptables status

Okay, How do I check to see if Network Filtering is turned on and do I need to use IP forwarding? Any help appreciated...

Thanks,

Justin Curtis

Offline ronaldjayr_jover

  • Linux Noob !
  • *
  • Posts: 29
NAT Questions Im missing something simple
« Reply #1 on: January 05, 2006, 05:30:48 AM »
Good day,

  Just want to ask if your linux box is your gateway on your network or just another workstation on your network?

Quote
iptables -A POSTROUTING -p all -s 10.22.92.111 -o eth0 -j SNAT --to 172.24.9.211
iptables -A PREROUTING -p all -d 172.24.9.211 -i eth0 -j DNAT --to 10.22.92.111
 
 
   From the above mentioned, what is the IP address of your box and what is the other IP address?

You can check if your iptables is working by typing on IPTABLES -L. You can see the chains that you have created.