Local Webserver Told “Access Forbidden!”, Even Browsing from Same Local Machine

My localhost webserver told me that it could not let me access any pages because I browsed from another machine.

Since I am so sure that I sat down on the same machine, i.e. my notebook, as this webserver, I wondered and think it was unbelievable.

However, using Wireshark to catch packages, I found that it real! .. I used an source IP address of global network to connect with localhost network. How surprising!

After trying for while, I got the cause. The source IP address was changed, so that I set an ‘IPTABLES’ rule wrong.

It masqueraded all packets from my computer without filtering, ever local packets to localhost.

So, I changed it as a following rule.

-t NAT -A POSTROUTING -j MASQUERADE

to

-t NAT -A POSTROUTING -j MASQUERADE -s 192.168.3.0/24

Advertisements

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s