How to permit all ports for permitted IPs

The following snippet from my iptables script is:
SAMSUNG=192.168.168.10
KEYTEL1=aa.bb.123.80
KEYTEL2=cc.dd.200.64

 iptables -A INPUT -i eth0 -s $KEYTEL1 -p tcp --syn -m multiport --dports 21,5090,5003,6001,6002 -j ACCEPT
 iptables -A INPUT -i eth0 -s $KEYTEL2 -p tcp --syn -m multiport --dports 21,5090,5003,6001,6002 -j ACCEPT

iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp --dport 21 -j DNAT --to-destination $SAMSUNG:21
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp --dport 5090 -j DNAT --to-destination $SAMSUNG:5090
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp --dport 5003 -j DNAT --to-destination $SAMSUNG:5003
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp --dport 6001 -j DNAT --to-destination $SAMSUNG:6001
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp --dport 6002 -j DNAT --to-destination $SAMSUNG:6002

iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL2 -p tcp --dport 21 -j DNAT --to-destination $SAMSUNG:21
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL2 -p tcp --dport 5090 -j DNAT --to-destination $SAMSUNG:5090
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL2 -p tcp --dport 5003 -j DNAT --to-destination $SAMSUNG:5003
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL2 -p tcp --dport 6001 -j DNAT --to-destination $SAMSUNG:6001
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL2 -p tcp --dport 6002 -j DNAT --to-destination $SAMSUNG:6002

Open in new window

Basically, I am trying to permit only 2 IPs access through the firewall: KEYTEL1 and KEYTEL2. These IP can access ports 21,5090,5003,6001,6002. Access by these IPs to these ports is redirected to host SAMSUNG. Testing on the rules as shown indicate they work, but I am wondering ...

I'd rather configure it to permit these IP's to permit all port. Is there a way to do that and accomplish the redirection?

If not, is there a more concise way to write this? As written it takes (#IPs) x (#Ports) DNAT rules. Adding another port means 2 more rules.
LVL 1
jmarkfoleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Duncan RoeSoftware DeveloperCommented:
Omit --dport?
0
jmarkfoleyAuthor Commented:
I found a solution:
iptables -t nat -A PREROUTING -i eth0 -s $KEYTEL1 -p tcp -m -multiport --dports 21,5090,5003,6001,6002 -j DNAT --to-destination $SAMSUNG

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmarkfoleyAuthor Commented:
I figured it out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software Firewalls

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.