Can not access Linux server over the Internet

hi i have linux server connected to internet through a switch/router. i have opened a port on the router and i am able to connect to the server if iptables is off. but when it is on i cant.

i want to create a rule in iptables so that it accepts packets coming from a particular datacard. it should reject any other request.

the port on the server is 22.

thanx in advance....

Please post network information and your man iptables ("linux") configuration.

Please post the output of:

[man iptables -L ("Linux")](CENTOS Man Pages and CENTOS Commands at the UNIX and Linux Forums -L&section=0&os="Linux")

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  192.168.1.3          anywhere            tcp dpt:ssh state NEW
ACCEPT     tcp  --  192.168.1.8          anywhere            tcp dpt:ssh state NEW
ACCEPT     tcp  --  192.168.1.6          anywhere            tcp dpt:ssh state NEW
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
Chain FORWARD (policy DROP)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I suggest you start by accepting the (authorized) IP address of the source and rejecting all other IP addresses.

When you get that working, then you can refine to add the port.

but the ips generated from the datacards are changing they are not static.
how to allow net connection from only one datacard!!!!!

---------- Post updated at 03:50 PM ---------- Previous update was at 01:47 PM ----------

is there any way i can check the esn bits of datacard in ip tables ??

Only the last octet of the IP address is dynamic. Work with the first three octets first. Get a minimal baseline going and keep it simple.

thanx for helping but can u help with an example.
day i want to open port for ip say 112.140.123.234
say last 2 octets are dynamic then wat would be the command in unix?

Thank you all for helping
i got the solution for my problem its port knocking
zeroflux.org