데비안 ‘무시’/etc/network/if-pre-up.d/iptables etc / network

시작시 iptables 규칙이 자동으로로드되기를 원합니다. 데비안의 위키에 따르면 이것은 /etc/network/if-pre-up.d/에 iptables라는 이름의 스크립트를 배치하여 수행 할 수 있습니다.

cat /etc/network/if-pre-up.d/iptables
#!/bin/sh
/sbin/iptables-restore < /etc/firewall/iptables.rules
/sbin/ip6tables-restore < /etc/firewall/ip6tables.rules

이 스크립트는 작동합니다. 루트로 실행하면 방화벽 규칙이 적용됩니다. 그러나 재부팅시 방화벽 규칙은 없습니다. 내가 뭘 잘못하고 있죠?

요청시 : / etc / network / interfaces (이 파일을 건드리지 않았습니다)

user@DebianVPS:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp



답변

iptables-persistent이 작업에 패키지를 사용하십시오 .

당신의 규칙을 정의 /etc/iptables/rules.4하고 /etc/iptables/rules.6및 사용 (서비스를 활성화하는 것을 잊지 마세요 update-rc.d, chkconfig또는 당신이 좋아하는 도구입니다.


답변

이 문제는 스크립트의 권한 비트와 관련이있을 수 있습니다. 이 명령의 출력은 무엇입니까? 파일이 포함되어 있습니까?

run-parts --test /etc/network/if-pre-up.d


답변

왜 그렇게 쉬운가요?

1-iptables 규칙 만들기

2- “sudo apt-get install iptables-persistent”를 실행하면 규칙을 저장하고 부팅 후 복원 할 것인지 묻습니다.

3- 당신은 끝났습니다


답변