Last active
August 29, 2015 14:07
-
-
Save thanhtam92/ce58733e3226e2252252 to your computer and use it in GitHub Desktop.
iptables, open port linux,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.cyberciti.biz/tips/linux-iptables-examples.html | |
http://www.cyberciti.biz/faq/linux-unix-open-ports/ | |
http://serverfault.com/questions/163244/linux-kernel-not-passing-through-multicast-udp-packets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
link: http://serverfault.com/questions/129086/how-to-start-stop-iptables-on-ubuntu | |
------------------------- | |
1. tao file `iptables` trong etc/init.d/ voi noi dung: | |
#!/bin/sh -e | |
### BEGIN INIT INFO | |
# Provides: iptables | |
# Required-Start: mountvirtfs ifupdown $local_fs | |
# Default-Start: S | |
# Default-Stop: 0 6 | |
### END INIT INFO | |
# July 9, 2007 | |
# James B. Crocker <[email protected]> | |
# Creative Commons Attribution - Share Alike 3.0 License (BY,SA) | |
# Script to load/unload/save iptables firewall settings. | |
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" | |
IPTABLES=/sbin/iptables | |
IPTABLES_SAVE=/sbin/iptables-save | |
IPTABLES_RESTORE=/sbin/iptables-restore | |
IPTABLES_CONFIG=/etc/iptables.conf | |
[ -x $IPTABLES ] || exit 0 | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
log_action_begin_msg "Starting firewall" | |
type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true | |
if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true | |
;; | |
stop) | |
log_action_begin_msg "Saving current firewall configuration" | |
if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
log_action_begin_msg "Flushing ALL firewall rules from chains!" | |
if $IPTABLES -F ; then | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
log_action_begin_msg "Deleting ALL firewall chains [Warning: ACCEPTING ALL PORT SERVICES!]" | |
if $IPTABLES -X ; then | |
$IPTABLES -P INPUT ACCEPT | |
$IPTABLES -P FORWARD ACCEPT | |
$IPTABLES -P OUTPUT ACCEPT | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
;; | |
save) | |
log_action_begin_msg "Saving current firewall configuration" | |
if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
;; | |
force-reload|restart) | |
log_action_begin_msg "Reloading firewall configuration [Warning: POTENTIAL NETWORK INSECURITY DURING RELOAD]" | |
$IPTABLES -F | |
$IPTABLES -X | |
if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then | |
log_action_end_msg $? | |
else | |
log_action_end_msg $? | |
fi | |
;; | |
*) | |
echo "Usage: /etc/init.d/iptables {start|stop|save|restart|force-reload}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
2. cap quyen: | |
- chmod +x *iptables* | |
- chmod 777 *iptables* | |
3. chay: `./update-rc.d iptables defaults` trong folder /usr/sbin | |
4. xong | |
5. test: service iptables stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://tvheadend.org/projects/tvheadend/wiki/VLC_Multicasting | |
http://www.youtube.com/watch?v=InxO6tviZOE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment