Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Short version: Are there any special settings for NAT to work correctly on Linux' virtual network interfaces?

I am running a Linux (2.6.39-2-486 Debian build) box as NAT server. It has a real network interface eth0, which connects to the outside, and a virtual one eth0:0 with address and netmask /24 to an inside network. Several computers inside connect to the internet via this box (having their default gateway set to, which has its firewall set up as (default forward policy set for debugging purposes):

iptables -F
iptables -A INPUT -j ACCEPT
iptables -A OUTPUT -j ACCEPT
iptables -P FORWARD DROP
iptables -A FORWARD -s -j ACCEPT
iptables -A FORWARD -d -j ACCEPT
iptables -t nat -F
iptables -t nat -A POSTROUTING -s '!' -d -j MASQUERADE

Most of the times, this setup works just fine. SSH, HTTP, other traffic works. However, connections to some SSL-secured sites will block indefinitely after connecting, even though the connection works when trying to run wget directly from the server. Other SSL-sites work just fine, however. Example:

client:~> wget -dv
Setting --verbose (verbose) to 1
DEBUG output created by Wget 1.12 on linux-gnu.

--2011-07-24 15:59:14--
Caching =>
Connecting to||:443... connected.
Created socket 3.
Releasing 0x08ccd160 (new refcount 1).
Initiating SSL handshake.

Any idea what is going on here? I have played around with different -j LOG settings, but lack the enlightenment to select the right logging to see what's going wrong.

share|improve this question

migrated from Jul 24 '11 at 14:33

This question came from our site for professional and enthusiast programmers.

The best would be to get a tcpdump of the issue on the NAT box eth0 interface, that would be useful to see if the DNAT rules acts as expected. Also, mangle/raw table are empty, right?

share|improve this answer

I bet your using a ppp connection and have not set TCP MSS

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.