我正在尝试使用 CentOS 7 盒子制作路由器。
enp2s2f0 ---> 外部区域 ---> 直接连接到互联网。 enp2s2f1 ---> 内部区域 ---> 连接到 PC(将来会连接到交换机)
查看我的实际 ifconfig 结果:
[root@localhost ~]# ifconfig
enp2s2f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::216:35ff:fe5c:913a prefixlen 64 scopeid 0x20<link>
inet6 2a01:e35:2e02:90f0:216:35ff:fe5c:913a prefixlen 64 scopeid 0x0<global>
ether 00:16:35:5c:91:3a txqueuelen 1000 (Ethernet)
RX packets 255 bytes 25694 (25.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 191 bytes 25734 (25.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 25
enp2s2f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::216:35ff:fe5c:9139 prefixlen 64 scopeid 0x20<link>
ether 00:16:35:5c:91:39 txqueuelen 1000 (Ethernet)
RX packets 54 bytes 5486 (5.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 1644 (1.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 26
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我的接口配置文件:
enp2s2f0
HWADDR="00:16:35:5C:91:3A"
TYPE="Ethernet"
BOOTPROTO="dhcp"
ONBOOT="yes"
ZONE="external"
enp2s2f1
HWADDR="00:16:35:5C:91:39"
TYPE="Bridge"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="10.100.0.1"
NETMASK="255.255.255.0"
NM_CONTROLLED="no"
DHCPD 配置文件:
ddns-update-style interim;
allow booting;
allow bootp;
authoritative;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
subnet 10.100.0.0 netmask 255.255.255.0 {
interface enp2s2f1;
range 10.100.0.10 10.100.0.200;
default-lease-time 21600;
max-lease-time 43200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.100.0.255;
option routers 10.100.0.1;
option domain-name-servers 8.8.8.8;
next-server 10.100.0.1;
}
防火墙规则:
[root@localhost dhcp]# firewall-cmd --list-all
internal (default, active)
interfaces: enp2s2f1
sources:
services: dhcpv6-client dns http https ipp-client mdns samba-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
当然,IPv4 转发也是启用的。
我的问题是,如果你查看 ifconfig 的结果,enp2s2f1 没有获得他的静态 IP,通常是 10.100.0.1
我删除了 NetworkManager。
内部电脑获取了 IP,但我无法 ping 通路由器,也无法访问互联网。
有任何想法吗 ???
谢谢