Questions Tagged With nathttp://linuxexchange.org/tags/nat/?type=rssquestions tagged <span class="tag">nat</span>enThu, 25 Apr 2013 17:53:29 -0400Virtualbox + NAT + Host Onlyhttp://linuxexchange.org/questions/3095/virtualbox-nat-host-only<p>I have two VirtualBox VMs running. Both are running CentOS. </p> <p>The first VM has 4 NICs that are bonded to together. All four NICs are using Host-Only for their config. The second VM has one NIC that is set to use NAT.</p> <p>Let me preface this by saying, I haven't setup any routes...</p> <p>Why am I able to ping from second VM (10.0.2.15) to the first VM (192.168.56.101) successfully? </p> <p>The routes for the second VM are as follows:</p> <pre><code>Destination Gateway Genmask Flags MSS Window irtt Iface 10.0.2.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 default 10.0.2.2 0.0.0.0 UG 0. 0 0 eth0 </code></pre> <p>Thanks for your help in advance! </p>paulcalabroThu, 25 Apr 2013 17:53:29 -0400http://linuxexchange.org/questions/3095/virtualbox-nat-host-onlynatvirtualboxiptables configuration script - need help with ithttp://linuxexchange.org/questions/1206/iptables-configuration-script-need-help-with-it<p>This section is part of a larger install-script I'm working on, and my knowledge of iptables stinks (still learning it), so what I need is for this to be in the right order, with the right options enabled.</p> <p>Basically I want: - to allow in what need be, to drop (not reject - what I don't want) - to have separation of the info into the appropriate custom log files in /var/log - to be as safe as possible and secure against probes, attacks etc, yet still usable - to allow NAT port forwarding (I have a router like many people do) (I use SSH and VNC in/out)</p> <p>This is intended to be used on an Ubuntu desktop machine (Lucid Lynx or later)</p> <p>Again... I know this stinks, but I need some serious help with it. Some options are in there, just not enabled, and that's fine.</p> <p>I've updated the script on 08/13/10.</p> <pre> #! /bin/bash # # ####################################################################################################################### # iptables setup and configuration # ####################################################################################################################### # # The following is a script for setting up and configuring iptables on a desktop computer running Ubuntu. # iptables -F # # ####################################################################################################################### # Logging # ####################################################################################################################### # iptables -A OUTPUT -j LOG iptables -A INPUT -j LOG iptables -A FORWARD -j LOG # # # ####################################################################################################################### # iptables-rules-input-policies # ####################################################################################################################### # iptables -P INPUT ACCEPT iptables -P FORWARD DROP iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT # # ####################################################################################################################### # Allow unlimited outbound traffic # ####################################################################################################################### # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT # # ####################################################################################################################### # icmp, INPUT and ports setup # ####################################################################################################################### # iptables -A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT iptables -A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT iptables -A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT iptables -A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 113 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5500 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5800 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT # # ####################################################################################################################### # Securing INPUT # ####################################################################################################################### # iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,RST FIN,RST -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,ACK FIN -j DROP iptables -A INPUT -p tcp -m tcp --tcp-flags ACK,URG URG -j DROP iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP # # ####################################################################################################################### # Allow freenode to talk to gidentd # ####################################################################################################################### # iptables -A INPUT -s chat.freenode.net -p tcp --dport 113 -j ACCEPT # # ####################################################################################################################### # Enable IP Forwarding # ####################################################################################################################### # echo 1 > /proc/sys/net/ipv4/ip_forward # # ####################################################################################################################### # IP Masquerading # ####################################################################################################################### # # (not needed if intranet is not using private ip-addresses) iptables -t nat -A POSTROUTING -o ppp+ -j MASQUERADE # # ####################################################################################################################### # iptables-anti-attack-measures-policies # ####################################################################################################################### # # In the following section set it 1 to enable the feature or 0 to disable the feature # # TCP SYN cookie protection from SYN floods echo 1 > /proc/sys/net/ipv4/tcp_syncookies # # Drop ICMP echo-request messages sent to broadcast or multicast addresses echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts # # Drop source routed packets echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route # # Don't accept ICMP redirect messages echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects # # Don't send ICMP redirect messages echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects # # Enable source address spoofing protection echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter # # Log packets with impossible source addresses echo 1 > /proc/sys/net/ipv4/conf/all/log_martians # # ####################################################################################################################### # Lockdown INPUT # ####################################################################################################################### # iptables -A INPUT -j DROP iptables -P INPUT DROP # # ####################################################################################################################### # iptables-save workaround # ####################################################################################################################### # iptables-save -c > /etc/iptables.rules iptables-restore </pre>RonWed, 11 Aug 2010 23:02:37 -0400http://linuxexchange.org/questions/1206/iptables-configuration-script-need-help-with-itubuntuiptablesfirewallnatConnect via SSH/Samba from 1 box to a hidden box (NAT/PAT?) setup?http://linuxexchange.org/questions/145/connect-via-sshsamba-from-1-box-to-a-hidden-box-natpat-setup<p>I need to access a Linux box via SSH &amp; Samba that is hidden/connected behind another one.</p> <p>Setup :-</p> <pre> A switch B C |----| |---| |----| |----| |eth0|----| |----|eth0| | | |----| |---| |eth1|----|eth1| |----| |----| </pre> <p>Eg, SSH/Samba from A to C</p> <p>How does one go about this?<br> I was thinking that it cannot be done via IP alone? Or can it?</p> <p>Could B say "hi on eth0, if your looking for 192.168.0.2, its here on eth1"?<br> Is this NAT? This is a large private network, so what about if another PC has that IP?!</p> <p>More likely it would be PAT?<br> A would say "hi 192.168.109.15:1234"<br> B would say "hi on eth0, traffic for port 1234 goes on here eth1"<br> How could that be done? </p> <p>And would the SSH/Samba demons see the correct packet header info and work??</p> <p>IP info :-</p> <pre> A - eth0 - 192.168.109.2 B - eth0 - 192.168.109.15 - eth1 - 192.168.0.1 C - eth1 - 192.168.0.2 </pre> <p>A, B &amp; C are RHEL (RedHat) But Windows computers can be connected to the switch. I configured the 192.168.0.* IPs, they are changeable.</p> <p>Any help?</p>Ian VaughanWed, 28 Apr 2010 17:02:58 -0400http://linuxexchange.org/questions/145/connect-via-sshsamba-from-1-box-to-a-hidden-box-natpat-setupsshsambanatpatnetworking