Linux Ubuntu 綜合簡單使用及配置

2021-07-24 15:43:24 字數 2050 閱讀 9105

# whereis iptables #檢視系統是否安裝防火牆可以看到:

iptables: /sbin/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz #表示已經安裝iptables

# apt-get install iptables #如果預設沒有安裝,請執行此命令安裝防火牆

# iptables -l #檢視防火牆配置資訊

# vi /etc/iptables.rules #修改防火牆出入規則配置檔案

# 新增以下內容:

···*filter

:input drop [0:0]

:forward accept [0:0]

:output accept [0:0]

:syn-flood - [0:0]

-ainput -i lo -j accept

-ainput -m state --state related,established -j accept

-ainput -p tcp -m state --state new -m tcp --dport 21 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 22 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 23 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 80 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 443 -j accept

-ainput -p udp -m state --state new -m udp --dport 7988 -j accept

-aoutput -p udp --dport 7988 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 7989 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 8080 -j accept

-ainput -p tcp -m state --state new -m tcp --dport 8089 -j accept

-ainput -p icmp -m limit --limit 100/sec --limit-burst 100 -j accept

-ainput -p icmp -m limit --limit 1/s --limit-burst 10 -j accept

-ainput -p tcp -m tcp --tcp-flags fin,syn,rst,ack

syn -j syn-flood

-ainput -j reject --reject-with icmp-host-prohibited

-a syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j return

-a syn-flood -j reject --reject-with icmp-port-unreachable

commit

···# iptables-restore < /etc/iptables.rules #使防火牆規則生效

# vi /etc/network/if-pre-up.d/iptables #建立檔案,新增以下內容,使防火牆開機啟動

#!/bin/bash

iptables-restore < /etc/iptables.rules

# chmod +x /etc/network/if-pre-up.d/iptables #新增執行許可權

# iptables -l -n檢視規則是否生效.

# ufw enable #開啟防火牆

# ufw disable #關閉防火牆

# ufw staus #檢視防火牆是否開啟

linux ubuntu 簡單優盤操作

檢視插入的裝置 裝置可在 dev 中檢視 往往優盤裝置會以sdb標識 其中 sdb是裝置的總稱 sdb1與sdb2是該裝置的分割槽 檢視裝置的檔案系統格式 fdisk l 檢視裝置各個分割槽的大小 df h 將裝置掛載到某一目錄,其中ext4是要掛載的裝置 dev sdb2的檔案系統格式,media...

Linux ubuntu 壓縮方式簡單操作方法

1 屌絲版 1 gzip gz格式的壓縮包 解壓縮gunzip 2 bzip2 bz2格式的壓縮包 解壓縮bunbzip2 2 高富帥版 1 tar 引數 c 建立 壓縮 x 釋放 解壓縮 v 顯示提示資訊 f 制定壓縮檔案名字 z 使用gzip方式壓縮檔案 gz j 使bzip方式壓縮檔案 bz2...

linux ubuntu 配置雙網絡卡 簡單方式

第一種方法是在路由表中新增路由規則 修改網絡卡配置檔案 開啟檔案 sudo vi etc network inte ces新增如下 auto eno1 iface eno1 inet static address 192.168.1.103 netmask 255.255.255.0 auto en...