ES460というNICがたくさん生えてるおもちゃを手に入れたので、ルータにしてみようと思います。
今回は普段使いのネットワークが手狭になってきたので、サーバを置くイントラネットを構築しようと思います。ネットマスク24だと狭くなってきたので22にしてみます。さすがに4桁台のIPを置くことはないと思うので、これで十分だと思います。
今回のES460ですが、セキュリティ監視サーバらしく、NICが4ポートついています。CPUはAtom E3825、RAMはDDR3L 4GB、ストレージは64GB SSDが載っていました。
これをルータとしてセッティングしていこうと思います。メインのネットワークはRTX1200の配下で192.168.1.0/24ですが、ES460に192.168.8.1/22のネットワークをぶら下げようという算段です。
+------------------------------+ | CentOS Stream 8 | | gateway | | ES460(Atom E3825) | | 192.168.1.250/24 (enp1s0) | | 192.168.8.1/22 (enp3s0) | +-enp1s0----------------enp3s0-+ | | | | RTX1200(Internet) Intranet
とりあえず、設定の前のES460のHWをちょろっと見ていきます。
# lshw -short
H/W path Device Class Description
========================================================
system ES460 (To be filled by O.E.M.)
/0 bus ES460
/0/0 memory 64KiB BIOS
/0/15 memory 4GiB System Memory
/0/15/0 memory 4GiB DIMM DDR3 1600 MHz (0.6 ns)
/0/15/1 memory DIMM [empty]
/0/1f memory 112KiB L1 cache
/0/20 memory 1MiB L2 cache
/0/21 processor Intel(R) Atom(TM) CPU E3825 @ 1.33GHz
/0/100 bridge Atom Processor Z36xxx/Z37xxx Series SoC Transaction Register
/0/100/2 card0 display Atom Processor Z36xxx/Z37xxx Series Graphics & Display
/0/100/12 generic Atom Processor Z36xxx/Z37xxx Series SDIO Controller
/0/100/13 scsi1 storage Atom Processor E3800 Series SATA AHCI Controller
/0/100/13/0.0.0 /dev/sda disk 64GB 2.5" SATA SSD 3M
/0/100/13/0.0.0/1 volume 600MiB Windows FAT volume
/0/100/13/0.0.0/2 volume 1GiB Linux filesystem partition
/0/100/13/0.0.0/3 /dev/sda3 volume 31GiB Linux LVM Physical Volume partition
/0/100/14 bus Atom Processor Z36xxx/Z37xxx, Celeron N2000 Series USB xHCI
/0/100/14/0 usb1 bus xHCI Host Controller
/0/100/14/1 usb2 bus xHCI Host Controller
/0/100/1a generic Atom Processor Z36xxx/Z37xxx Series Trusted Execution Engine
/0/100/1c bridge Atom Processor E3800 Series PCI Express Root Port 1
/0/100/1c/0 enp1s0 network I210 Gigabit Network Connection
/0/100/1c.1 bridge Atom Processor E3800 Series PCI Express Root Port 2
/0/100/1c.1/0 enp2s0 network I210 Gigabit Network Connection
/0/100/1c.2 bridge Atom Processor E3800 Series PCI Express Root Port 3
/0/100/1c.2/0 enp3s0 network I210 Gigabit Network Connection
/0/100/1c.3 bridge Atom Processor E3800 Series PCI Express Root Port 4
/0/100/1c.3/0 enp4s0 network I210 Gigabit Network Connection
/0/100/1f bridge Atom Processor Z36xxx/Z37xxx Series Power Control Unit
/0/100/1f/0 system PnP device PNP0b00
/0/100/1f/1 system PnP device PNP0c02
/0/100/1f/2 system PnP device PNP0c02
/0/100/1f/3 communication PnP device PNP0501
/0/100/1f/4 input PnP device PNP0303
/0/100/1f/5 system PnP device PNP0c02
/0/100/1f.3 bus Atom Processor E3800/CE2700 Series SMBus Controller
/1 input0 input Power Button
/2 input1 input Sleep Button
/3 input2 input Power Button
/4 input23 input Video Bus
/5 input25 input Intel HDMI/DP LPE Audio HDMI/DP,pcm=0
/6 input26 input Intel HDMI/DP LPE Audio HDMI/DP,pcm=1
/7 input27 input PC Speaker
ネットワークはI210が4つですね。電源ボタンがあることになっていますが、外見にはありません。電源をつないだら勝手に電源が入るようにBIOSの設定がしてあります。
ディスクはInnodiskの3ME4というのが載っていました。MLCなフラッシュなので、ちょっと嬉しいですね。
それでは設定をしていきます。インターフェイスの諸々の設定は冒頭の図のようにenp1s0=192.168.1.250/24、enp3s0=192.168.8.1/22で設定しています。ここの手順は省略します。
enp3s0の配下は192.168.8.1~192.168.11.255が使用できます。このうち192.168.11.10~ 192.168.11.254のレンジをDHCPで使用するようにします。
サクッとDHCPをインストールし、サーバ設定をしていきます。
# dnf -y install dhcp-server
# vi /etc/dhcp/dhcpd.conf
#以下を追記
option domain-name "homelab.gurees.net";
option domain-name-servers 192.168.8.1;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.8.0 netmask 255.255.252.0 {
range dynamic-bootp 192.168.11.10 192.168.11.254;
option broadcast-address 192.168.11.255;
option routers 192.168.8.1;
}
設定ファイルを作ったら、ファイアウォールの解放と、DHCPサーバの自動起動設定と起動を行っていきます。
# firewall-cmd --add-service=dhcp --permanent
success
# firewall-cmd --reload
success
# systemctl enable dhcpd
Created symlink /etc/systemd/system/multi-user.target.wants/dhcpd.service → /usr/lib/systemd/system/dhcpd.service.
# systemctl start dhcpd
# systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-12-17 05:07:30 EST; 8s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 15376 (dhcpd)
Status: "Dispatching packets..."
Tasks: 1 (limit: 22916)
Memory: 4.9M
CGroup: /system.slice/dhcpd.service
mq15376 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
これでDHCPサーバの設定ができました。パソコンをETH3につなげると192.168.11.10のIPが貰えると思います。
次にIPフォワードを有効にします。
# vi /etc/sysctl.conf #以下を追記 net.ipv4.ip_forward=1
IPフォワードの有効を反映させます。
# sysctl -p net.ipv4.ip_forward = 1
とりあえず、内部のネットワークのルータなので、全部通す形でtrustedにしちゃいます。
# firewall-cmd --permanent --zone=trusted --change-interface=enp1s0 # firewall-cmd --permanent --zone=trusted --add-masquerade # firewall-cmd --permanent --zone=trusted --change-interface=enp3s0 # firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -o enp3s0 -j MASQUERADE # firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i enp3s0 -o enp1s0 -j ACCEPT # firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i enp1s0 -o enp3s0 -j ACCEPT # firewall-cmd --reload
最後に192.168.1.0/24側のネットワークから通信できるようにRTX1200にルーティングを入れておきます。
# ip route 192.168.8.0/22 gateway 192.168.1.250
これで192.168.1.0/24側からアクセスできるようになります。