iptables: send all incoming traffic to virtual machine
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
iptables: send all incoming traffic to virtual machine
I have a firewall (Endian) running in a VirtualBox VM.
How can I send all incoming traffic on my WAN-interface of my host-system (CentOS 5.2) to my Virtual Machine ?
My Firewall-VM uses the physical interface.
I do not want access from the internet to my host system. All traffic needs to be filtered by my firewall (guest system).
Could I block everything on my host-system ?
I choose not to have a dedicated firewall, but I am bugged with the security-aspects of my setup.
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761
Rep:
I think you have it backwards. When you turn on your computer, which OS comes up first? The host or the guest? Ideally, which ever is the first you want that as the firewall.
I think you have it backwards. When you turn on your computer, which OS comes up first? The host or the guest? Ideally, which ever is the first you want that as the firewall.
It is clear that the host-system is up first.
So how then do I reject all traffic on my host (Centos 5.3) ?
The documentation includes this basic example. This will block any external incoming connections unless they were initiated by your computer.
Code:
#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.