LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-28-2021, 07:58 AM   #1
Nightbane
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: Disabled
Unhappy UFW Config to only allow 1 IP address


Having looked at several sources, I'm stumped as to how to do this. I want the Ubuntu computer to only be able to communicate with one other computer, at IP address 1.2.3.4 from across the internet.

My attempt (with a new Ubuntu Server VM) as root:

ufw disable

ufw default deny incoming
ufw default deny outgoing

ufw allow in on 1.2.3.4
ufw allow out on 1.2.3.4

ufw allow from 192.168.1.0/24
ufw allow to 192.168.1.0/24

ufw enable

ssh user@1.2.3.4


The output of this attempt is a ssh connection timeout. I've also tried these in place of lines 4-5:

ufw allow from 1.2.3.4
ufw allow to 1.2.3.4

I can't get it to work. Basically, I want the system's firewall to block all internet communication except to that server. I need it totally secure.

Last edited by Nightbane; 04-28-2021 at 08:06 AM.
 
Old 04-28-2021, 02:34 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
http://manpages.ubuntu.com/manpages/...n8/gufw.8.html, Easier but you can read tutorials on how to make rules and what order they need to be in.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UFW denying all incoming access even where rules allow crypted Ubuntu 2 05-19-2018 07:59 AM
[SOLVED] What UFW rule will allow port 80 to localhost but only from localhost? wh33t Ubuntu 1 12-14-2016 11:13 PM
[SOLVED] Using hosts.allow to allow only postfix to use port 25 Mogget Linux - Server 3 03-28-2009 04:36 AM
How to allow a router's address in /etc/hosts.allow? xpucto Linux - Newbie 1 02-26-2008 05:28 AM
hosts.allow file to allow only a single IP sailu_mvn Linux - Networking 2 06-06-2007 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration