Thursday, July 9, 2009

Open ports using IPTABLES

If you want your machine to respond to requests initiated from elsewhere on the internet you need to open the required ports. You need to know below details first:



1. Service name you want to open up
2. Is it a tcp or udp service?
3. Port number(s) uses by service?

Example:


To enable ssh access to your box from anywhere on for Class A networks, you could use something like



iptables -A allowed -p tcp --dport 22 -s 10.2.0.0/16 -j ACCEPT
iptables -A allowed -p udp --dport 22 -s 10.2.0.0/16 -j ACCEPT


iptables -A allowed -p tcp --dport 22 -s 10.8.0.0/16 -j ACCEPT
iptables -A allowed -p udp --dport 22 -s 10.8.0.0/16 -j ACCEPT

This allows both udp and tcp traffic from either of the two class A networks to access port 22 on your machine.

9 comments:

vishyc88 said...

hiii...i really admire ur efforts to spread linux knowledge...its me vishnu..i had called u on 13th..i have a problem..i wud wanna roll out microsoft based O.S's via pxe..and the pxe server must be maintained on rhel5. any help wud be appreciated..thnx
im RHCE #805009850340831.
thank you.

sanjaydalal4u said...

Hi,

For PXE boot in linux, if you want to start in a graphical mode then just type a argument after your text at pxe boot.
like : rhel5 textmode (It will goes for pxe textbased installation)
like : rhel5 rescue (It will goes for rescue mode)

Vishnu said...

Hi, its me vishnu again..i tried the above stated commands. but it doesnt work.
ill paste my dhcpd.conf file. please have a look:
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;


#option domain-name-servers 145.253.2.75, 193.174.32.18;
option domain-name-servers 192.168.1.3;
default-lease-time 86400;
max-lease-time 604800;

authoritative;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.1.3;
filename "linux-install/pxelinux.0";
}

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.49;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;




}
please let me know if there is any changes required.

sanjaydalal4u said...

Hi,
Try this link for windows installation thru pxe.
http://oss.netfarm.it/guides/pxe.php

We have implemented this and works file....shortly we will publish full document on Blog..Enjoy :)

sanjaydalal4u said...

Hi,

Can you please let me know you able to start the PXE boot installation in Graphical mode?
If yes then you can also able to start it using the textmode using the argument.
If now then let me know i will post the procedure how to configure pxe server both for linux and windows

Vishnu said...

i found out the answer with a little trial and error. im so happy now.
here's what i did:
you simply got to enter the number on the boot: prompt
for eg:
in my case...
0 = boot using the local machine
1 = start RHEL5 installation

All we got to do is enter the number and then the kernel option/parameter
so " linux text or linux rescue"
eg: boot: 1 linux text

thank god. :)

sanjaydalal4u said...

Yes you can also install windows xp , windows 2003 server vista and windows 7.
I will make a post how to install soon with detail configuration.

Configuration is some light difference by distribution. I have successfully able to install RHEL3,4,5,FC4-12,Ubuntu server-desktop,Windows xp,
windows 7, windows vista, windows 2003 server.

Will post you soon a document...

Vishnu said...

ok, it would be nice if the configuration is done in RHEL5. :)

Vishnu said...

please make it soon. im impatient :P

sanjay's shared items

My Blog List