본문 바로가기

전체 글

룰셋 갱신 지켜보기 / Monitoring ruleset updates source: https://wiki.nftables.org/wiki-nftables/index.php/Monitoring_ruleset_updates 이전 글: 다음 글: nft monitor를 이용하여 ruleset의 변화를 지켜볼 수 있습니다. % nft monitor # 새로운 rule을 생성되는 것을 보고 싶으면 % nft monitor new rules 다음은 Terminal 1에서 nft monitor를 입력하고 다른 Terminal 2에서 rule을 추가하면서 Terminal 1의 출력을 보인 것입니다. Terminal 1 에서 보기 명령어를 입력합니다. salsal@r3:~$ sudo nft monitor Terminal 2 에서 rule을 추가합니다. salsal@r3:~$ sudo n.. 더보기
룰셋 레벨 명령 / Operations at ruleset level source: https://wiki.nftables.org/wiki-nftables/index.php/Operations_at_ruleset_level 이전 글: 룰 표현 / Building rules through expressions 다음 글: 룰셋 갱신 지켜보기 / Monitoring ruleset updates nft native 문법 목록 확인 salsal@r3:~$ sudo nft list ruleset table ip filter { chain output { type filter hook output priority 0; policy accept; ip daddr 7.7.7.7 counter packets 0 bytes 0 ip daddr 6.6.6.6 counter packets 0 b.. 더보기
룰 표현 / Building rules through expressions source: https://wiki.nftables.org/wiki-nftables/index.php/Building_rules_through_expressions 이전 글: 명령어에서 오류 출력 다음 글: Operations at ruleset level nftables은 다음과 같은 표현을 제공합니다. 표현 의미 기호 의미 eq eqaul == 같은 ne not equal != 같지 않은 lt less than 큰 le less than and equal = 크거나 같은 주의할 사항은 shell에서 를 사용하면 입출력 redirection으로 오해할 수 있으니 \ 를 이용해야 합니다. 아래 룰은 TCP/22가 아닌 경우를 명시한 것입니다. nft add rule filter input tcp dpo.. 더보기
명령어에서 오류 출력 source: https://wiki.nftables.org/wiki-nftables/index.php/Error_reporting_from_the_command_line 이전 글: 순식간에 많은 룰 변경 / Atomic rule replacement 다음 글: 룰 표현 / Building rules through expressions nft 명령어를 입력하다가 문법이 틀리거나 parameter나 값을 제대로 입력하지 않으면 오류 메시지를 출력해 줍니다. 아래는 존재하지 않는 테이블 (filter) 을 지정했을 때 오류 메시지를 ^^^^^^^^^ 으로 알려줍니다. salsal@r3:~$ sudo nft list chain filter output Error: Could not process rule: T.. 더보기
순식간에 많은 룰 변경 / Atomic rule replacement source: https://wiki.nftables.org/wiki-nftables/index.php/Atomic_rule_replacement 이전 글: 룰 설정 / Simple rule management 다음 글: 명령어에서 오류 출력 iptables에서는 bash script를 이용해 rule을 하나하나 추가하는 것이 일반적입니다. 그런데 대량의 rule을 추가해 나간다면, 어느 한 순간에 보면, 의도하는 완전한 상태가 아니라 부분만 완성된 상태입니다. 반면 nftables에서는 새로운 rule을 메모리에 모두 올리고, 한 순간에 rule을 모두 적용하는 수단을 제공합니다. 따라서 이것을 Atomic rule replacement 라고 합니다. nft -f를 이용합니다. 형태는 아래와 같습니다... 더보기
룰 설정 / Simple rule management source: https://wiki.nftables.org/wiki-nftables/index.php/Simple_rule_management 이전 글: 체인 설정 / Configuring chains 다음 글: 순식간에 많은 룰 변경 / Atomic rule replacement 참고: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/getting-started-with-nftables_configuring-and-managing-networking 패켓에 대한 조건을 확인하고 조건에 맞다면 그 결과에 따라 처리(행동)(accept, drop, c.. 더보기
체인 설정 / Configuring chains source: https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains 이전 글: 테이블 설정 / Configuring tables 다음 글: 룰 설정 / Simple rule management iptables 처럼 nftables에서도 체인에 rule을 선언하여 추가할 수 있습니다. 다만 iptables과 달리, INPUT, OUTOUT, FORWARD와 같은 pre-defined chain은 없습니다. 패켓을 필터링하기 위해서 base chain을 생성하고, 그것을 netfilter hook에 추가하여 줍니다. 설정을 매우 유연하게 해 주며, 불필요한 pre-defined chain에 의한 지연을 피할 수 있게 해 줍니다. netfi.. 더보기
Ubuntu nftables 설치 source: https://wiki.nftables.org/wiki-nftables/index.php/Nftables_from_distributions 다음 글: 테이블 설정 / Configuring tables Ubuntu 18.04 에서 salsal@r3:~$ lsb_release -d Description:Ubuntu 18.04.5 LTS salsal@r3:~$ sudo apt policy nftables [sudo] password for salsal: nftables: Installed: (none) Candidate: 0.8.2-1 Version table: 0.8.2-1 500 500 http://kr.archive.ubuntu.com/ubuntu bionic/universe amd64 P.. 더보기