Link to home
Start Free TrialLog in
Avatar of deck16
deck16

asked on

Simple question: closing ports

I want to close off some ports on my machine and I was told to use iptables (I have kernel 2.4.3). I can't figure out how to do it from the man page. What command would I issue to say close off port 111?
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zxcvzxcv
zxcvzxcv

you put a place to put my IP. I don't have a static IP. What do I put there? (localhost?)
Avatar of deck16

ASKER

rrr, I hate the auto-login (sorry for posting with a different account I'm at by brother's house (zxcvzxcv) not used to having to logout and then back in :-)
What about

ADDR=$(/sbin/ifconfig ppp0 | grep addr | cut -d':' -f 2 | cut -d' ' -f 1)

There the address is set as it IP number of your machine
and later refer to the IP address as $ADDR

Like


iptables -A FORWARD -d $ADDR/32 --dport 111 -j DROP




Avatar of deck16

ASKER

why $ADDR/32 in the iptables argument?
that is the mask for the address 32 bits = 255.255.255.255