iptables in a virtual machine Watch

philD
Badges: 0
Rep:
?
#1
Report Thread starter 7 years ago
#1
Hey

I'd like to ask you guys a question about iptables. I have an ubuntu virtual image and I need to do some work with iptables. As an example:

I have a network diagram and on that diagram there is a web server running mysql.
This is the rule I want to use:

iptables -A INPUT -s 192.168.146.130-192.168.146.133 -dport 14887 -j ACCEPT

This says to accept packets from computers wanting to make connections to mysql on 192.168.146.130, which is the ip address of my virtual machine, and then drop the others

Apparently i don't have to setup create a network of virtual machines because I can test the rule using just 1 machine, but i'm not sure because i'm a newbie at this
Any advice would be greatly appreciated. Great site by the way!

Phil
0
reply
ch0llima
Badges: 14
#2
Report 7 years ago
#2
EDIT - I was wrong. Here goes again...

Welcome to TSR, first of all!

I have to say your post is a little muddled, and I'm not sure what you're trying to do. The way I understand it is this: you have MySQL listening on 192.168.146.130:14887, correct? You're wanting to accept connections from 192.168.146.130-133 on that port and drop everything else?

If I'm correct, then this rule should be fine and only needs to be applied on the machine itself running MySQL (192.168.146.130) and you should be good to go. You can test it by simply using any machines which can reach the VMs, whether or not they're host machines or other guests running on the same network. Both of these could be connected and configured to use a loopback interface of some kind for testing purposes.
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Do you think the internet has made political discussion more aggressive?

Yes (53)
98.15%
No (1)
1.85%

Watched Threads

View All