Shell script to reset ebtables on Linux

in Categories Firewall last updated September 5, 2016

Ebtables is an application program used to set up and maintain the tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is analogous to the iptables application, but less complicated, due to the fact that the Ethernet protocol is much simpler than the IP protocol. ebtables used with bridges on Linux. The following script will stop and clean all ebtables rules:

Linux Firewall: Simple Shell Script To Stop and Flush All Iptables Rules

in Categories Security last updated April 24, 2008
#!/bin/bash
# Linux Firewall: Simple Shell Script To Stop and Flush All Iptables Rules
# Some Linux distros like Debian do not have /etc/init.d/iptables stop script
# This can be also called from cron job if you are testing new firewall on
# remote box to avoid lock out
# -------------------------------------------------------------------------
# Copyright (c) 2004 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

Shell Script to start DLink PCL wireless lan card 520 / 510

in Categories Script last updated April 10, 2008
#!/bin/sh
# Script to start DLink PCL wireless lan card 520 
# ----------------------------------------------------------------
# Copyright (c) 2006 nixCraft <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# See url for more info:
# https://www.cyberciti.biz/tips/linux-install-and-configure-dlink-dwl-g-520-wireless-lan-pci-card.html
# -------------------------------------------------------------------------
 
# assing values 
# use 'iwlist ra0 scanning' command to get values
SSID=nixcraft
TYPE=Managed
CHANNEL=6
KEY="your-key"
INET=ra0
IWC="/sbin/iwconfig"
 
# ok config ra0
$IWC $INET essid $SSID
$IWC $INET mode $TYPE
$IWC $INET channel $CHANNEL
$IWC $INET key $KEY
 
# firewall 
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
modprobe ip_conntrack
modprobe ip_conntrack_ftp
 
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
 
# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
 
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INET -m state --state ESTABLISHED,RELATED -j ACCEPT
 
#allow bittorent incomming client request :)
iptables -A INPUT -p tcp --destination-port 6881:6882 -j ACCEPT
 
#Uncomment below to allow sshd incoming client request
#iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT
 
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP