RHEL7을 사용하기 시작했고 systemd와 함께 제공되는 변경 사항에 대해 조금 배우고 있습니다.
/sbin/service iptables save
방화벽 으로 수행 할 수있는 방법이 있습니까?
$ /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
설명서에서 찾을 수있는 가장 가까운 병렬은 --reload
다음과 같습니다.
Reload the firewall without loosing state information:
$ firewall-cmd --reload
그러나 저장 여부를 명시 적으로 말하지 않습니다.
답변
RHEL 7.0의 방화벽 버전에는 “저장”스크립트가 없으며 실행중인 방화벽 구성을 영구 구성으로 복사 할 수 없습니다. --permanent
명령 행에 변경 사항 을 추가 하여 방화벽으로 방화벽 변경 사항을 저장 하십시오. 이를 사용하지 않으면 변경 한 내용은 일시적이며 시스템을 다시 시작할 때 유실됩니다.
예를 들면 다음과 같습니다.
firewall-cmd --add-service=http # Running config
firewall-cmd --add-service=http --permanent # Startup config
방화벽의 이후 버전 (RHEL 7 이후)에는 실행중인 구성을 저장하는 방법이 포함되어 있으며 현재 Fedora 및 RHEL 7.1에서 사용할 수 있습니다 . 이 경우 명령은 다음과 같습니다.
firewall-cmd --runtime-to-permanent
답변
SIP 서비스와 일부 IP를 추가해야했습니다
/ usr / lib / firewalld / services / 디렉토리 에 다른 xml 서비스 파일을 기반으로 sip.xml을 추가했습니다 .
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>SIP</short>
<description>This is SIP, Yo! </description>
<port protocol="udp" port="5060"/>
</service>
그런 다음 sip 서비스를 방화벽에 추가했습니다.
# firewall-cmd --add-service=sip --permanent
그런 다음 /etc/firewalld/zones/public.xml에서 서비스에 IP를 추가했습니다.
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description></description>
<service name="dhcpv6-client"/>
<service name="http"/>
<service name="ssh"/>
<service name="https"/>
<rule family="ipv4">
<source address="x.x.x.x/32"/>
<service name="sip"/>
<accept/>
</rule>
</zone>
로깅 수준을 추가하면 LOG를 추가 할 수도 있습니다
<rule family="ipv4">
<source address="x.x.x.x/32"/>
<service name="sip"
<log prefix="sip" level="info"/>
<accept/>
</rule>
영역에 규칙을 추가 한 후 실행
# firewall-cmd --reload
iptables를 확인하십시오-모두 설정되어 있어야합니다.