# iptables v1.4.7: Bad IP address "



## mtwiscool (Jul 8, 2014)

here is my iptables config: http://pastebin.com/ur3LHZii

it gives me this error:


```
[[email protected] ~]# ./NAT.sh
iptables v1.4.7: Bad IP address "192.168.1.099"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.098"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.097"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.096"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.095"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.094"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.093"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.092"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.091"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.090"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.089"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.088"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.087"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.086"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.085"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.084"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.083"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.082"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.081"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.080"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.079"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.078"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.078"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.069"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.068"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.059"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.058"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.049"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.048"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.039"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.038"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.029"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.028"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.019"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.018"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.009"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.1.008"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.099"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.098"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.097"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.096"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.095"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.094"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.093"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.092"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.091"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.090"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.089"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.088"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.087"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.086"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.085"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.084"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.083"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.082"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.081"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.080"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.079"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.078"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.069"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.068"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.059"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.058"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.049"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.048"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.039"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.038"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.029"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.028"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.019"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.018"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.009"

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.7: Bad IP address "192.168.2.008"

Try `iptables -h' or 'iptables --help' for more information.
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[[email protected] ~]#
```


----------



## D. Strout (Jul 8, 2014)

Clearly because of the extra zeroes on the last octet. 192.168.2.008 is an invalid IP, 192.168.2.8 isn't.

And I don't even know anything about iptables. Seriously, if you're already having problems like _this_... (shudders)


----------



## mtwiscool (Jul 8, 2014)

D. Strout said:


> Clearly because of the extra zeroes on the last octet. 192.168.2.008 is an invalid IP, 192.168.2.8 isn't.
> 
> And I don't even know anything about iptables. Seriously, if you're already having problems like _this_... (shudders)


Thank you for your help all errors are gone.

I used the 0's as it should not have any issues as it means the same number.


----------



## linuxthefish (Jul 8, 2014)

Stop this madness. http://en.wikipedia.org/wiki/255_(number)


----------



## Mun (Jul 8, 2014)

192.168.2.001 pumped into binary and then back out does not equal 192.168.2.1. Each charcter in binary must be represented in 1s and 0s. As such what you did was make an overflow as you provided more data then the data field could handle.


----------



## tonyg (Jul 8, 2014)

Oh, my...here we go.

Seriously dude, are you going to post every time you have a hiccup?


----------



## Aldryic C'boas (Jul 8, 2014)

I say Curtis starts charging him for every help thread, since we're stuck with the kid.  Would likely make enough to pay all of VPSB's bills and then some.


----------



## drmike (Jul 8, 2014)

As long as he's learning and reasonable... we can hold our popcorn in bucketed hand and wait for the main feature.

Friday, coming Friday!


----------



## MartinD (Jul 8, 2014)

To be honest, I'm sure there are a fair few folk in here who would call themselves providers that wouldn't have known what the problem was or how to fix it.


----------



## Rallias (Jul 8, 2014)

cp /etc/sysconfig/iptables.conf /etc/sysconfig/iptables.conf.save; cat /etc/sysconfig/iptables.conf.save | sed 's/\.0/./g' | sed 's/\.0/./g' > /etc/sysconfig/iptables.conf


----------



## sean (Jul 8, 2014)

Rallias said:


> cp /etc/sysconfig/iptables.conf /etc/sysconfig/iptables.conf.save; cat /etc/sysconfig/iptables.conf.save | sed 's/\.0/./g' | sed 's/\.0/./g' > /etc/sysconfig/iptables.conf


No rm -rf /, forkbomb or similar?


----------



## Aldryic C'boas (Jul 8, 2014)

Rallias said:


> cp /etc/sysconfig/iptables.conf /etc/sysconfig/iptables.conf.save; cat /etc/sysconfig/iptables.conf.save | sed 's/\.0/./g' | sed 's/\.0/./g' > /etc/sysconfig/iptables.conf


Chained seds... that's just nasty.  Your logic needs work, as well.

Let's do that correctly, shall we: _cat iptables.conf | perl -ne 's/\.0(0)?(?!$)/\./g; print;' > iptables.conf_


----------



## KuJoe (Jul 9, 2014)

MartinD said:


> To be honest, I'm sure there are a fair few folk in here who would call themselves providers that wouldn't have known what the problem was or how to fix it.


I'm going to have to disagree here. If you get an error message that says "*Bad IP Address*" then any reasonable person who's ever logged into a server before should know that the problem is that the IP address is bad. Had he tried to ping the bad IPs before opening this thread, he _should_ have realized that.


----------



## MartinD (Jul 9, 2014)

KuJoe said:


> I'm going to have to disagree here. If you get an error message that says "*Bad IP Address*" then any reasonable person who's ever logged into a server before should know that the problem is that the IP address is bad. Had he tried to ping the bad IPs before opening this thread, he _should_ have realized that.


Joe... I agree, completely.. however I think you missed the point there.. . There are quite a few folk on here that like to throw mud, having a laugh at other peoples expense however they only do that as they have yet to be caught out. I'm sure a few of us could throw a few names in to the pot of "_calls themselves a provider, doesn't really know what they're doing_"


----------



## mtwiscool (Jul 9, 2014)

Please close this as it has been solved.

Thank You @D. Strout


----------



## tonyg (Jul 9, 2014)

This happens in "real" life too.

Some people become so dependent on others to solve technical problems that for any small issue they instinctively call out for help.


----------



## Rallias (Jul 13, 2014)

Aldryic C said:


> Chained seds... that's just nasty.  Your logic needs work, as well.
> 
> Let's do that correctly, shall we: _cat iptables.conf | perl -ne 's/\.0(0)?(?!$)/\./g; print;' > iptables.conf_


Meh, I'm not a bash expert.


----------

