Firewalld - source IP not working

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Firewalld - source IP not working
# 8  
Old 09-26-2017
I got this going, the only way I got it to work was by adding rich rules.

First I added the rich rules

Code:
 firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.10" service name="ssh" accept'

Code:
 firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.99" service name="ssh" accept'

Then I removed the ssh service from the zone, which is the part that got me, seems counter intuiative.

Code:
 firewall-cmd --permanent zone=ABCinternal --remove-service=ssh

Here is the /etc/firewalld/ABCinternal.xml file BEFORE I make the changes

Code:
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>ABCinternal</short>
  <description>ABCinternal - internal trusted networks</description>
  <source address="192.168.1.10"/>
  <source address="192.168.1.99"/>
  <service name="ssh"/>
</zone>

And now after

Code:
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>ABCinternal</short>
  <description>ABCinternal - internal trusted networks</description>
  <rule family="ipv4">
    <source address="192.168.1.10"/>
    <service name="ssh"/>
    <accept/>
  </rule>
  <rule family="ipv4">
    <source address="192.168.1.99"/>
    <service name="ssh"/>
    <accept/>
  </rule>
</zone>

I may use ipset if the list grows.
This User Gave Thanks to fishface For This Post:
# 9  
Old 09-29-2017
One thing I now find odd though, is when I use

Code:
 firewall-cmd --zone=ABCinternal --list-services
no output

It doesn't list any services even though they are there, so the command doesn't list rich rules, this seems somewhat confusing - I now have to use

Code:
  firewall-cmd --zone=ABCinternal --list-all
ABCinternal (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources: 
  services:
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
	rule family="ipv4" source address="192.168.1.10" service name="ssh" accept
	rule family="ipv4" source address="1192.168.1.99" service name="ssh" accept

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Disk Space Utilization in HTML format working in one environment and not working on the other

Hi Team, I have written the shell script which returns the result of the disk space filesystems which has crossed the threshold limit in HTML Format. Below mentioned is the script which worked perfectly on QA system. df -h | awk -v host=`hostname` ' BEGIN { print "<table border="4"... (13 Replies)
Discussion started by: Harihsun
13 Replies

2. Shell Programming and Scripting

Working web service call not working with curl

Hello, Newbie here, I have a perfectly well working web service call I can issue from chrome (PC Windows 10) and get the results I want (a dimmer being turned on in Fibaro Home Center 2 at level 40) I am not allowed to post urls but the below works with http and :// and... (3 Replies)
Discussion started by: abigbear
3 Replies

3. Red Hat

Firewalld - multiple services / sources?

If you have a system with one network interface, and you want to allow ssh from some addresses, freeipa-ldap from others, and https (which is part of freeipa-ldap) from another one; and you do not want to have a sea of rich rules... how do you do that? I can't tell if firewalld is just really... (2 Replies)
Discussion started by: jnojr
2 Replies

4. Shell Programming and Scripting

Automating pbrun /bin/su not working, whenever manually it is working using putty

I am trying to automate a script where I need to use pbrun /bin/su but for some reason it is not passing thru the pbrun as my code below. . ~/.bash_profile pbrun /bin/su - content c h 1 hpsvn up file path I am executing this from an external .sh file that is pointing to this scripts file... (14 Replies)
Discussion started by: jorgejac
14 Replies

5. Red Hat

Nslookup working but ping not working at windows client

Hi Team we have created a DNS server at RHEL6.2 environment in 10.20.203.x/24 network. Everything is going well on linux client as nslookup, ping by host etc in entire subnet. We are getting problem in windows client as nslookup working as well but not ping. all the firewall is disabled and... (5 Replies)
Discussion started by: boby.kumar
5 Replies

6. Red Hat

Os Open source dialer not working on Centos Asterisk platform

Hi We have one centos Server on Asterisk platform and using OS Open source dialer for dialing outbound connections.We are using eyebeam as a softphone for calling with Server ip 192.168.1.X.Today i found dialing issues with each client side phones.Not showing pause/resume button when browse... (0 Replies)
Discussion started by: Vaibhav.T
0 Replies

7. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

8. Solaris

GUI not working... CLI is working fine

Hello, I have X4500 running Solaris 10. I can access it through CLI but I cannot see the GUI. When I reboot it, the GUI works till all the files are loaded (ie., the initial boot sequence) and it prompts me to enter username and password and there it ends. The screen just has a blinking cursor... (4 Replies)
Discussion started by: bharu_sri
4 Replies
Login or Register to Ask a Question