Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables nat firewall under fedora core 1

Reply
Thread Tools Display Modes

Iptables nat firewall under fedora core 1

 
 
Jim
Guest
Posts: n/a

 
      12-16-2003, 05:24 PM
I was using Redhat 7.1 for my nat firewall for quite a while but now
that redhat is switching to pay or fedora I thought I would try
recreating my firewall when running nmap -sS -O against the old one I
get what I want:

Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on (192.168.77.1)
(The 1590 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
25/tcp open smtp
80/tcp open http
443/tcp open https
Remote operating system guess: Linux 2.4.16 - 2.4.18
Uptime 41.975 days (since Tue Nov 4 11:24:56 2003)

Nmap run completed -- 1 IP address (1 host up) scanned in 25 seconds

With the Fedora Box I get a lot of stuff I don't want.
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on (192.168.77.1)
(The 1590 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
80/tcp open http
111/tcp filtered sunrpc
137/tcp filtered netbios-ns
138/tcp filtered netbios-dgm
139/tcp filtered netbios-ssn
443/tcp open https
1024/tcp filtered kdm
1080/tcp filtered socks
Remote operating system guess: Linux Kernel 2.4.0 - 2.5.20
Uptime 5.717 days (since Wed Dec 10 17:39:08 2003)

Nmap run completed -- 1 IP address (1 host up) scanned in 17 seconds


How in the world Do I get the filtered to appear to be closed and why
can I no longer pass port 25?

my current machine works with the following using the exact same on
fedora core 1. but Fedora is different. Did I miss a big change from
netfilter?

#!/bin/bash
/sbin/dhcpcd
ipt="/sbin/iptables"
modp="/sbin/modprobe"
ipad=`ifconfig eth0 | grep "inet addr" | awk -F "[B:]" '{print
$2}'|cut -d ' ' -f 1` #for this we will assume we get 192.168.77.1
clean="/root/firewall/awkit" #just a small awk file that removes all
rules
echo $ipad #verify we got a good dhcp ip address
#load modules
$modp ip_tables
$modp iptable_nat
$modp iptable_filter
$modp ip_conntrack
$modp ip_conntrack_ftp
$modp ip_nat_ftp
$modp ipt_MASQUERADE
$modp ipt_REDIRECT


#flush rules and clean everything
$clean

#turn ipforwarding on
echo 1 > /proc/sys/net/ipv4/ip_forward

#turn input off by default
#$ipt -P INPUT DROP #comment this out to fix problems and allow accept
to work

#allow inputs that are needed.
#inside secure computers
$ipt -A INPUT -s $ipad -d 0/0 -j ACCEPT
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 1024 -j REJECT
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 111 -j DROP
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 137 -j DROP
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 138 -j DROP
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 139 -j DROP
$ipt -A INPUT -p tcp -s 0/0 -d $ipad --dport 1080 -j DROP
$ipt -A INPUT -p tcp -s 0/0 -d $ipad -j ACCEPT

#allow machine to talk to itsself.
$ipt -A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT

#allow inside machines to masquerade out.
$ipt -A POSTROUTING -t nat -s 192.168.80.0/24 -j MASQUERADE

#allow services through
$ipt -A PREROUTING -t nat -p tcp -i eth0 -d $ipad --dport 25 -j DNAT
--to 192.16
8.80.101:25
$ipt -A PREROUTING -t nat -p tcp -i eth0 -d $ipad --dport 80 -j DNAT
--to 192.16
8.80.101:80
$ipt -A PREROUTING -t nat -p tcp -i eth0 -d $ipad --dport 443 -j DNAT
--to 192.1
68.80.101:443
$ipt -A PREROUTING -t nat -p tcp -i eth0 -d $ipad --dport 22 -j DNAT
--to 192.16
8.80.101:22
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora Core 9 and atm Mathias Koerber Linux Networking 0 07-16-2008 08:39 AM
IPTables / Fedora Core 3 port forwarding lars@nulogic.net Linux Networking 2 05-26-2005 07:47 AM
Firewall rules in Fedora Core Daniel Camps Linux Networking 1 12-12-2004 09:39 PM
Strange SSH halting problem between Fedora Core 2/Fedora Core 3 Jonathan Abbey Linux Networking 4 12-03-2004 05:00 PM
PrismStumbler & Fedora Core 1 Sean Fernandez Linux Networking 0 04-16-2004 12:51 AM



1 2 3 4 5 6 7 8 9 10 11