LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   IPTABLES - Invalid argument (https://www.linuxquestions.org/questions/linux-networking-3/iptables-invalid-argument-626241/)

initialdrifteg6 03-06-2008 04:21 PM

IPTABLES - Invalid argument
 
I'm trying to redirect anyone who is not authenticated on my network to a different IP address. All authenticated users are assigned an IP address on the network 192.168.0.0 and all of the unauthenticated users are assigned an IP address on the network 192.168.1.0. The DHCP server is working properly and is assigning the IP addresses correctly, but i'm having issues getting the iptables command to work properly.

The commands i'm trying as root:

/sbin/iptables -A PREROUTING -s 192.168.1.0/255/255/255/0 -p tcp -j DNAT --to-destination 64.111.96.38

this command is returning

iptables: Invalid argument

my dhcp configuration file looks like this

ddns-updates off;
ddns-update-style interim;
authoritative;
shared-network local {
subnet 192.168.0.0 netmask 255.255.255.0 {
deny unknown-clients;
range 192.168.0.2 192.168.0.10;
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 74.128.1.33 , 74.128.1.31;
option broadcast-address 192.168.0.255;
host MacbookPro {
hardware ethernet 00:19:e3:aa:84:aa;
}
host iPhone {
hardware ethernet 00:1c:b3:aa:a3:aa;
}
host blacknight {
hardware ethernet 00:14:6c:aa:9a:aa;
}
}
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.110;
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.0.1;
allow unknown-clients;

}
}




any thoughts? thanks

rayfordj 03-06-2008 06:23 PM

Quote:

Originally Posted by initialdrifteg6 (Post 3080437)
The commands i'm trying as root:

/sbin/iptables -A PREROUTING -s 192.168.1.0/255/255/255/0 -p tcp -j DNAT --to-destination 64.111.96.38

this command is returning

iptables: Invalid argument

(assuming the 255/255/255/0 really is 255.255.255.0)
it most likely returns because there is not PREROUTING chain on the (default) filter table. You probably want to use the nat table.

try:
Code:

/sbin/iptables -t nat -A PREROUTING -s 192.168.1.0/255.255.255.0 -p tcp -j DNAT --to-destination 64.111.96.38


All times are GMT -5. The time now is 05:53 AM.