LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Iptables help (https://www.linuxquestions.org/questions/slackware-14/iptables-help-946016/)

cod_liver_0il 05-20-2012 11:16 AM

Iptables help
 
Hi all, i'm using alienbobs firewall (firewall-generator) and I have an internal lan camera (ip-cam) i want to view through browser....the cam doesn't need to access to my external device. I just want access it through a browser, no nat needed.

ppp0 is my external device (net)
wlan0 is my link to my ip-cam
192.168.0.0/24

I just need to be able access it, anyone help?

With alienbobs firewall generator it uses nat for the second device, so wondered if a couple of rules added to the firewall script would do.

Richard Cranium 05-20-2012 06:19 PM

A diagram showing your network configuration/connections would help.

cod_liver_0il 05-21-2012 06:50 AM

Richard Cranium, this is a standalone machine with ppp0 being my net connection and wlan0 is my device to connect to my ip-cam.

ppp0 dynamic ip
wlan0 192.168.0.1
ipcam 192.168.0.2

hope that helps, thanks.

GazL 05-23-2012 11:43 AM

Eric's firewall generator is very good, but I tend to view it as a little bit of overkill for a simple workstation setup.

This is what I use on my workstation.

/etc/rc.d/rc.firewall:
Code:

#!/bin/sh

IPT='/usr/sbin/iptables'
MODPROBE="/sbin/modprobe"

########################################################################
#  Load FTP connection tracking helper modules
#    (needed for proper operation of ftp client connections)

$MODPROBE nf_conntrack
$MODPROBE nf_conntrack_ftp


########################################################################
#  Set default policies for packets that get to the end of a chain
#  without matching a rule.

#  DROP packets on reaching end of INPUT, FORWARD and OUTPUT chain
#  (a.k.a "Better safe than sorry" mode)

$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT DROP

#  These next ones aren't strictly necessary as we're not using these
#  chains, but setting them to a known state is never a bad idea.

$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT

$IPT -t mangle -P PREROUTING ACCEPT
$IPT -t mangle -P INPUT ACCEPT
$IPT -t mangle -P FORWARD ACCEPT
$IPT -t mangle -P OUTPUT ACCEPT
$IPT -t mangle -P POSTROUTING ACCEPT

# $IPT -t raw -P PREROUTING ACCEPT
# $IPT -t raw -P OUTPUT ACCEPT


########################################################################
#  Flush any existing rules and chains
#   

$IPT -F
$IPT -F -t nat
$IPT -F -t mangle
# $IPT -F -t raw

$IPT -X
$IPT -X -t nat
$IPT -X -t mangle
# $IPT -X -t raw

########################################################################

########################################################################
#  Now insert our own ruleset
#   

#  INPUT CHAIN

$IPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

$IPT -A INPUT -i lo -j ACCEPT

#  Example of opening up ports to new incoming connections
#  $IPT -A INPUT -p tcp -i eth0 -m multiport --dports 21,22,25,80,443 \
#  --syn -m state --state NEW -j ACCEPT


#  OUTPUT CHAIN

$IPT -A OUTPUT -j ACCEPT

########################################################################

It doesn't block any outgoing connections, only incoming ones but that should be sufficient for a standalone/workstation type of machine.

cod_liver_0il 05-23-2012 11:57 AM

Thanks GazL, i will give that a go. :)

pokute 05-24-2012 06:18 PM

I can't say 100% for sure without knowing more about your LAN, but I'm guessing you probably have a wireless router and have it set up to prevent machines on your WLAN from talking directly to each other. In other words, you may not be having an iptables issue on your client machine at all.


All times are GMT -5. The time now is 11:48 PM.