我正在尝试在几台运行 Ubuntu 的虚拟机之间设置一个私有网络。对于此特定配置,我需要启用 eth1 - eth9。出于某种原因,eth1 可以正常打开(使用ifconfig eth1 up
,但不适用于ifup eth1
),但找不到 eth2-9。我去年能够做到这一点,但我忘记了设置的一些细节。
这是我的/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
auto eth0
iface eth0 inet dhcp
iface group1 inet static
address 192.168.1.1
netmask 255.255.255.0
iface group2 inet static
address 192.168.2.1
netmask 255.255.255.0
iface group3 inet static
address 192.168.3.1
netmask 255.255.255.0
iface group4 inet static
address 192.168.4.1
netmask 255.255.255.0
iface group5 inet static
address 192.168.5.1
netmask 255.255.255.0
iface group6 inet static
address 192.168.6.1
netmask 255.255.255.0
iface group7 inet static
address 192.168.7.1
netmask 255.255.255.0
iface group8 inet static
address 192.168.8.1
netmask 255.255.255.0
iface group9 inet static
address 192.168.9.1
netmask 255.255.255.0
iface group10 inet static
address 192.168.10.1
netmask 255.255.255.0
iface group11 inet static
address 192.168.11.1
netmask 255.255.255.0
iface group12 inet static
address 192.168.12.1
netmask 255.255.255.0
iface group13 inet static
address 192.168.13.1
netmask 255.255.255.0
iface group14 inet static
address 192.168.14.1
netmask 255.255.255.0
iface group15 inet static
address 192.168.15.1
netmask 255.255.255.0
iface group16 inet static
address 192.168.16.1
netmask 255.255.255.0
iface group17 inet static
address 192.168.17.1
netmask 255.255.255.0
iface group18 inet static
address 192.168.18.1
netmask 255.255.255.0
iface group19 inet static
address 192.168.19.1
netmask 255.255.255.0
iface group20 inet static
address 192.168.20.1
netmask 255.255.255.0
iface group21 inet static
address 192.168.21.1
netmask 255.255.255.0
iface group22 inet static
address 192.168.22.1
netmask 255.255.255.0
iface group23 inet static
address 192.168.23.1
netmask 255.255.255.0
iface group24 inet static
address 192.168.24.1
netmask 255.255.255.0
iface group25 inet static
address 192.168.25.1
netmask 255.255.255.0
iface group26 inet static
address 192.168.26.1
netmask 255.255.255.0
iface group27 inet static
address 192.168.27.1
netmask 255.255.255.0
iface group28 inet static
address 192.168.28.1
netmask 255.255.255.0
iface group29 inet static
address 192.168.29.1
netmask 255.255.255.0
iface group30 inet static
address 192.168.30.1
netmask 255.255.255.0
iface group31 inet static
address 192.168.31.1
netmask 255.255.255.0
iface group32 inet static
address 192.168.32.1
netmask 255.255.255.0
iface group33 inet static
address 192.168.33.1
netmask 255.255.255.0
iface group34 inet static
address 192.168.34.1
netmask 255.255.255.0
iface group35 inet static
address 192.168.35.1
netmask 255.255.255.0
iface group36 inet static
address 192.168.36.1
netmask 255.255.255.0
iface group37 inet static
address 192.168.37.1
netmask 255.255.255.0
iface group38 inet static
address 192.168.38.1
netmask 255.255.255.0
iface group39 inet static
address 192.168.39.1
netmask 255.255.255.0
iface group40 inet static
address 192.168.40.1
netmask 255.255.255.0
iface group41 inet static
address 192.168.41.1
netmask 255.255.255.0
iface group42 inet static
address 192.168.42.1
netmask 255.255.255.0
iface group43 inet static
address 192.168.43.1
netmask 255.255.255.0
iface group44 inet static
address 192.168.44.1
netmask 255.255.255.0
iface group45 inet static
address 192.168.45.1
netmask 255.255.255.0
iface group46 inet static
address 192.168.46.1
netmask 255.255.255.0
iface group47 inet static
address 192.168.47.1
netmask 255.255.255.0
iface group48 inet static
address 192.168.48.1
netmask 255.255.255.0
iface group49 inet static
address 192.168.49.1
netmask 255.255.255.0
iface group50 inet static
address 192.168.50.1
netmask 255.255.255.0
iface group51 inet static
address 192.168.51.1
netmask 255.255.255.0
iface group52 inet static
address 192.168.52.1
netmask 255.255.255.0
iface group53 inet static
address 192.168.53.1
netmask 255.255.255.0
iface group54 inet static
address 192.168.54.1
netmask 255.255.255.0
iface group55 inet static
address 192.168.55.1
netmask 255.255.255.0
iface group56 inet static
address 192.168.56.1
netmask 255.255.255.0
iface group57 inet static
address 192.168.57.1
netmask 255.255.255.0
iface group58 inet static
address 192.168.58.1
netmask 255.255.255.0
iface group59 inet static
address 192.168.59.1
netmask 255.255.255.0
iface group60 inet static
address 192.168.60.1
netmask 255.255.255.0
iface group61 inet static
address 192.168.61.1
netmask 255.255.255.0
iface group62 inet static
address 192.168.62.1
netmask 255.255.255.0
iface group63 inet static
address 192.168.63.1
netmask 255.255.255.0
iface group64 inet static
address 192.168.64.1
netmask 255.255.255.0
iface group65 inet static
address 192.168.65.1
netmask 255.255.255.0
iface group66 inet static
address 192.168.66.1
netmask 255.255.255.0
iface group67 inet static
address 192.168.67.1
netmask 255.255.255.0
iface group68 inet static
address 192.168.68.1
netmask 255.255.255.0
iface group69 inet static
address 192.168.69.1
netmask 255.255.255.0
iface group70 inet static
address 192.168.70.1
netmask 255.255.255.0
iface group71 inet static
address 192.168.71.1
netmask 255.255.255.0
iface group72 inet static
address 192.168.72.1
netmask 255.255.255.0
iface group73 inet static
address 192.168.73.1
netmask 255.255.255.0
iface group74 inet static
address 192.168.74.1
netmask 255.255.255.0
iface group75 inet static
address 192.168.75.1
netmask 255.255.255.0
iface group76 inet static
address 192.168.76.1
netmask 255.255.255.0
iface group77 inet static
address 192.168.77.1
netmask 255.255.255.0
iface group78 inet static
address 192.168.78.1
netmask 255.255.255.0
iface group79 inet static
address 192.168.79.1
netmask 255.255.255.0
iface group80 inet static
address 192.168.80.1
netmask 255.255.255.0
iface group81 inet static
address 192.168.81.1
netmask 255.255.255.0
iface group82 inet static
address 192.168.82.1
netmask 255.255.255.0
iface group83 inet static
address 192.168.83.1
netmask 255.255.255.0
iface group84 inet static
address 192.168.84.1
netmask 255.255.255.0
iface group85 inet static
address 192.168.85.1
netmask 255.255.255.0
iface group86 inet static
address 192.168.86.1
netmask 255.255.255.0
iface group87 inet static
address 192.168.87.1
netmask 255.255.255.0
iface group88 inet static
address 192.168.88.1
netmask 255.255.255.0
iface group89 inet static
address 192.168.89.1
netmask 255.255.255.0
iface group90 inet static
address 192.168.90.1
netmask 255.255.255.0
iface group91 inet static
address 192.168.91.1
netmask 255.255.255.0
iface group92 inet static
address 192.168.92.1
netmask 255.255.255.0
iface group93 inet static
address 192.168.93.1
netmask 255.255.255.0
iface group94 inet static
address 192.168.94.1
netmask 255.255.255.0
iface group95 inet static
address 192.168.95.1
netmask 255.255.255.0
iface group96 inet static
address 192.168.96.1
netmask 255.255.255.0
iface group97 inet static
address 192.168.97.1
netmask 255.255.255.0
iface group98 inet static
address 192.168.98.1
netmask 255.255.255.0
iface group99 inet static
address 192.168.99.1
netmask 255.255.255.0
mapping eth[1-9]
script /usr/local/sbin/pick-network.pl
auto eth1
auto eth2
auto eth3
auto eth4
auto eth5
auto eth6
auto eth7
auto eth8
auto eth9
我还安装了 isc-dhcp-server 并进行了编辑/etc/default/isc-dhcp-server
以包含所有接口,如下所示:
INTERFACES="eth0 eth1 eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9 eth10"
最后,我的样子如下/etc/dhcp/dhcpd.conf
:
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.200;
}
host server1 {
hardware ethernet 52:54:00:00:01:01;
fixed-address 192.168.1.1;
}
host client1 {
hardware ethernet 52:54:00:00:02:01;
fixed-address 192.168.1.2;
}
host attacker1 {
hardware ethernet 52:54:00:00:03:01;
fixed-address 192.168.1.3;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.10 192.168.2.200;
}
host server2 {
hardware ethernet 52:54:00:00:01:02;
fixed-address 192.168.2.1;
}
host client2 {
hardware ethernet 52:54:00:00:02:02;
fixed-address 192.168.2.2;
}
host attacker2 {
hardware ethernet 52:54:00:00:03:02;
fixed-address 192.168.2.3;
}
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.10 192.168.3.200;
}
host server3 {
hardware ethernet 52:54:00:00:01:03;
fixed-address 192.168.3.1;
}
host client3 {
hardware ethernet 52:54:00:00:02:03;
fixed-address 192.168.3.2;
}
host attacker3 {
hardware ethernet 52:54:00:00:03:03;
fixed-address 192.168.3.3;
}
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.10 192.168.4.200;
}
host server4 {
hardware ethernet 52:54:00:00:01:04;
fixed-address 192.168.4.1;
}
host client4 {
hardware ethernet 52:54:00:00:02:04;
fixed-address 192.168.4.2;
}
host attacker4 {
hardware ethernet 52:54:00:00:03:04;
fixed-address 192.168.4.3;
}
subnet 192.168.5.0 netmask 255.255.255.0 {
range 192.168.5.10 192.168.5.200;
}
host server5 {
hardware ethernet 52:54:00:00:01:05;
fixed-address 192.168.5.1;
}
host client5 {
hardware ethernet 52:54:00:00:02:05;
fixed-address 192.168.5.2;
}
host attacker5 {
hardware ethernet 52:54:00:00:03:05;
fixed-address 192.168.5.3;
}
subnet 192.168.6.0 netmask 255.255.255.0 {
range 192.168.6.10 192.168.6.200;
}
host server6 {
hardware ethernet 52:54:00:00:01:06;
fixed-address 192.168.6.1;
}
host client6 {
hardware ethernet 52:54:00:00:02:06;
fixed-address 192.168.6.2;
}
host attacker6 {
hardware ethernet 52:54:00:00:03:06;
fixed-address 192.168.6.3;
}
subnet 192.168.7.0 netmask 255.255.255.0 {
range 192.168.7.10 192.168.7.200;
}
host server7 {
hardware ethernet 52:54:00:00:01:07;
fixed-address 192.168.7.1;
}
host client7 {
hardware ethernet 52:54:00:00:02:07;
fixed-address 192.168.7.2;
}
host attacker7 {
hardware ethernet 52:54:00:00:03:07;
fixed-address 192.168.7.3;
}
subnet 192.168.8.0 netmask 255.255.255.0 {
range 192.168.8.10 192.168.8.200;
}
host server8 {
hardware ethernet 52:54:00:00:01:08;
fixed-address 192.168.8.1;
}
host client8 {
hardware ethernet 52:54:00:00:02:08;
fixed-address 192.168.8.2;
}
host attacker8 {
hardware ethernet 52:54:00:00:03:08;
fixed-address 192.168.8.3;
}
subnet 192.168.9.0 netmask 255.255.255.0 {
range 192.168.9.10 192.168.9.200;
}
host server9 {
hardware ethernet 52:54:00:00:01:09;
fixed-address 192.168.9.1;
}
host client9 {
hardware ethernet 52:54:00:00:02:09;
fixed-address 192.168.9.2;
}
host attacker9 {
hardware ethernet 52:54:00:00:03:09;
fixed-address 192.168.9.3;
}
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.200;
}
host server10 {
hardware ethernet 52:54:00:00:01:10;
fixed-address 192.168.10.1;
}
host client10 {
hardware ethernet 52:54:00:00:02:10;
fixed-address 192.168.10.2;
}
host attacker10 {
hardware ethernet 52:54:00:00:03:10;
fixed-address 192.168.10.3;
}
subnet 192.168.11.0 netmask 255.255.255.0 {
range 192.168.11.10 192.168.11.200;
}
host server11 {
hardware ethernet 52:54:00:00:01:11;
fixed-address 192.168.11.1;
}
host client11 {
hardware ethernet 52:54:00:00:02:11;
fixed-address 192.168.11.2;
}
host attacker11 {
hardware ethernet 52:54:00:00:03:11;
fixed-address 192.168.11.3;
}
subnet 192.168.12.0 netmask 255.255.255.0 {
range 192.168.12.10 192.168.12.200;
}
host server12 {
hardware ethernet 52:54:00:00:01:12;
fixed-address 192.168.12.1;
}
host client12 {
hardware ethernet 52:54:00:00:02:12;
fixed-address 192.168.12.2;
}
host attacker12 {
hardware ethernet 52:54:00:00:03:12;
fixed-address 192.168.12.3;
}
subnet 192.168.13.0 netmask 255.255.255.0 {
range 192.168.13.10 192.168.13.200;
}
host server13 {
hardware ethernet 52:54:00:00:01:13;
fixed-address 192.168.13.1;
}
host client13 {
hardware ethernet 52:54:00:00:02:13;
fixed-address 192.168.13.2;
}
host attacker13 {
hardware ethernet 52:54:00:00:03:13;
fixed-address 192.168.13.3;
}
subnet 192.168.14.0 netmask 255.255.255.0 {
range 192.168.14.10 192.168.14.200;
}
host server14 {
hardware ethernet 52:54:00:00:01:14;
fixed-address 192.168.14.1;
}
host client14 {
hardware ethernet 52:54:00:00:02:14;
fixed-address 192.168.14.2;
}
host attacker14 {
hardware ethernet 52:54:00:00:03:14;
fixed-address 192.168.14.3;
}
subnet 192.168.15.0 netmask 255.255.255.0 {
range 192.168.15.10 192.168.15.200;
}
host server15 {
hardware ethernet 52:54:00:00:01:15;
fixed-address 192.168.15.1;
}
host client15 {
hardware ethernet 52:54:00:00:02:15;
fixed-address 192.168.15.2;
}
host attacker15 {
hardware ethernet 52:54:00:00:03:15;
fixed-address 192.168.15.3;
}
subnet 192.168.16.0 netmask 255.255.255.0 {
range 192.168.16.10 192.168.16.200;
}
host server16 {
hardware ethernet 52:54:00:00:01:16;
fixed-address 192.168.16.1;
}
host client16 {
hardware ethernet 52:54:00:00:02:16;
fixed-address 192.168.16.2;
}
host attacker16 {
hardware ethernet 52:54:00:00:03:16;
fixed-address 192.168.16.3;
}
subnet 192.168.17.0 netmask 255.255.255.0 {
range 192.168.17.10 192.168.17.200;
}
host server17 {
hardware ethernet 52:54:00:00:01:17;
fixed-address 192.168.17.1;
}
host client17 {
hardware ethernet 52:54:00:00:02:17;
fixed-address 192.168.17.2;
}
host attacker17 {
hardware ethernet 52:54:00:00:03:17;
fixed-address 192.168.17.3;
}
subnet 192.168.18.0 netmask 255.255.255.0 {
range 192.168.18.10 192.168.18.200;
}
host server18 {
hardware ethernet 52:54:00:00:01:18;
fixed-address 192.168.18.1;
}
host client18 {
hardware ethernet 52:54:00:00:02:18;
fixed-address 192.168.18.2;
}
host attacker18 {
hardware ethernet 52:54:00:00:03:18;
fixed-address 192.168.18.3;
}
subnet 192.168.19.0 netmask 255.255.255.0 {
range 192.168.19.10 192.168.19.200;
}
host server19 {
hardware ethernet 52:54:00:00:01:19;
fixed-address 192.168.19.1;
}
host client19 {
hardware ethernet 52:54:00:00:02:19;
fixed-address 192.168.19.2;
}
host attacker19 {
hardware ethernet 52:54:00:00:03:19;
fixed-address 192.168.19.3;
}
subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.10 192.168.20.200;
}
host server20 {
hardware ethernet 52:54:00:00:01:20;
fixed-address 192.168.20.1;
}
host client20 {
hardware ethernet 52:54:00:00:02:20;
fixed-address 192.168.20.2;
}
host attacker20 {
hardware ethernet 52:54:00:00:03:20;
fixed-address 192.168.20.3;
}
subnet 192.168.21.0 netmask 255.255.255.0 {
range 192.168.21.10 192.168.21.200;
}
host server21 {
hardware ethernet 52:54:00:00:01:21;
fixed-address 192.168.21.1;
}
host client21 {
hardware ethernet 52:54:00:00:02:21;
fixed-address 192.168.21.2;
}
host attacker21 {
hardware ethernet 52:54:00:00:03:21;
fixed-address 192.168.21.3;
}
subnet 192.168.22.0 netmask 255.255.255.0 {
range 192.168.22.10 192.168.22.200;
}
host server22 {
hardware ethernet 52:54:00:00:01:22;
fixed-address 192.168.22.1;
}
host client22 {
hardware ethernet 52:54:00:00:02:22;
fixed-address 192.168.22.2;
}
host attacker22 {
hardware ethernet 52:54:00:00:03:22;
fixed-address 192.168.22.3;
}
subnet 192.168.23.0 netmask 255.255.255.0 {
range 192.168.23.10 192.168.23.200;
}
host server23 {
hardware ethernet 52:54:00:00:01:23;
fixed-address 192.168.23.1;
}
host client23 {
hardware ethernet 52:54:00:00:02:23;
fixed-address 192.168.23.2;
}
host attacker23 {
hardware ethernet 52:54:00:00:03:23;
fixed-address 192.168.23.3;
}
subnet 192.168.24.0 netmask 255.255.255.0 {
range 192.168.24.10 192.168.24.200;
}
host server24 {
hardware ethernet 52:54:00:00:01:24;
fixed-address 192.168.24.1;
}
host client24 {
hardware ethernet 52:54:00:00:02:24;
fixed-address 192.168.24.2;
}
host attacker24 {
hardware ethernet 52:54:00:00:03:24;
fixed-address 192.168.24.3;
}
subnet 192.168.25.0 netmask 255.255.255.0 {
range 192.168.25.10 192.168.25.200;
}
host server25 {
hardware ethernet 52:54:00:00:01:25;
fixed-address 192.168.25.1;
}
host client25 {
hardware ethernet 52:54:00:00:02:25;
fixed-address 192.168.25.2;
}
host attacker25 {
hardware ethernet 52:54:00:00:03:25;
fixed-address 192.168.25.3;
}
subnet 192.168.26.0 netmask 255.255.255.0 {
range 192.168.26.10 192.168.26.200;
}
host server26 {
hardware ethernet 52:54:00:00:01:26;
fixed-address 192.168.26.1;
}
host client26 {
hardware ethernet 52:54:00:00:02:26;
fixed-address 192.168.26.2;
}
host attacker26 {
hardware ethernet 52:54:00:00:03:26;
fixed-address 192.168.26.3;
}
subnet 192.168.27.0 netmask 255.255.255.0 {
range 192.168.27.10 192.168.27.200;
}
host server27 {
hardware ethernet 52:54:00:00:01:27;
fixed-address 192.168.27.1;
}
host client27 {
hardware ethernet 52:54:00:00:02:27;
fixed-address 192.168.27.2;
}
host attacker27 {
hardware ethernet 52:54:00:00:03:27;
fixed-address 192.168.27.3;
}
subnet 192.168.28.0 netmask 255.255.255.0 {
range 192.168.28.10 192.168.28.200;
}
host server28 {
hardware ethernet 52:54:00:00:01:28;
fixed-address 192.168.28.1;
}
host client28 {
hardware ethernet 52:54:00:00:02:28;
fixed-address 192.168.28.2;
}
host attacker28 {
hardware ethernet 52:54:00:00:03:28;
fixed-address 192.168.28.3;
}
subnet 192.168.29.0 netmask 255.255.255.0 {
range 192.168.29.10 192.168.29.200;
}
host server29 {
hardware ethernet 52:54:00:00:01:29;
fixed-address 192.168.29.1;
}
host client29 {
hardware ethernet 52:54:00:00:02:29;
fixed-address 192.168.29.2;
}
host attacker29 {
hardware ethernet 52:54:00:00:03:29;
fixed-address 192.168.29.3;
}
subnet 192.168.30.0 netmask 255.255.255.0 {
range 192.168.30.10 192.168.30.200;
}
host server30 {
hardware ethernet 52:54:00:00:01:30;
fixed-address 192.168.30.1;
}
host client30 {
hardware ethernet 52:54:00:00:02:30;
fixed-address 192.168.30.2;
}
host attacker30 {
hardware ethernet 52:54:00:00:03:30;
fixed-address 192.168.30.3;
}
subnet 192.168.31.0 netmask 255.255.255.0 {
range 192.168.31.10 192.168.31.200;
}
host server31 {
hardware ethernet 52:54:00:00:01:31;
fixed-address 192.168.31.1;
}
host client31 {
hardware ethernet 52:54:00:00:02:31;
fixed-address 192.168.31.2;
}
host attacker31 {
hardware ethernet 52:54:00:00:03:31;
fixed-address 192.168.31.3;
}
subnet 192.168.32.0 netmask 255.255.255.0 {
range 192.168.32.10 192.168.32.200;
}
host server32 {
hardware ethernet 52:54:00:00:01:32;
fixed-address 192.168.32.1;
}
host client32 {
hardware ethernet 52:54:00:00:02:32;
fixed-address 192.168.32.2;
}
host attacker32 {
hardware ethernet 52:54:00:00:03:32;
fixed-address 192.168.32.3;
}
subnet 192.168.33.0 netmask 255.255.255.0 {
range 192.168.33.10 192.168.33.200;
}
host server33 {
hardware ethernet 52:54:00:00:01:33;
fixed-address 192.168.33.1;
}
host client33 {
hardware ethernet 52:54:00:00:02:33;
fixed-address 192.168.33.2;
}
host attacker33 {
hardware ethernet 52:54:00:00:03:33;
fixed-address 192.168.33.3;
}
subnet 192.168.34.0 netmask 255.255.255.0 {
range 192.168.34.10 192.168.34.200;
}
host server34 {
hardware ethernet 52:54:00:00:01:34;
fixed-address 192.168.34.1;
}
host client34 {
hardware ethernet 52:54:00:00:02:34;
fixed-address 192.168.34.2;
}
host attacker34 {
hardware ethernet 52:54:00:00:03:34;
fixed-address 192.168.34.3;
}
# goes all the way to 99, but I can't post that many lines on SO.
我觉得很奇怪,eth1 可以工作,但其他的都不行——就像我说的,我以前也让它工作过(我记得使用相同的文件)。我在想是不是我漏掉了某个步骤,或者把这些文件放在了错误的目录中?
任何帮助都将非常感激。