我目前有一個 IP 為 127.0.0.1 的伺服器和 IP 為 127.0.0.2 的客戶端。我想在它們之間創建一個中間人伺服器,它也應該充當伺服器。
我應該如何將 IP 分配給這個新的中間人伺服器。
如何設定這個IP 我在VMWARE中使用ubuntu。請建議
修改 :
我在這裡設計了它(gksudo gedit /etc/network/interfaces)
auto lo
iface lo inet loopback
auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
auto eth0:1
iface eth0:1 inet static
name Ethernet alias LAN card
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
auto eth0:2
iface eth0:2 inet static
name Ethernet alias LAN card
address 192.168.1.3
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
但我仍然關注 ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:d5:f0:54
inet addr:192.168.28.128 Bcast:192.168.28.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed5:f054/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:129 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:63732 (63.7 KB) TX bytes:18881 (18.8 KB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:186 errors:0 dropped:0 overruns:0 frame:0
TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:25691 (25.6 KB) TX bytes:25691 (25.6 KB)
為什麼 ifconfig 沒有顯示新的 ip?
答案1
我不太確定你到底想做什麼 - 但使用環回介面很可能是錯誤的想法。
如果您的 vmware 主機上有虛擬系統 - 可能最好建立一些網絡,例如 192.168.1.0/24,並在該網路中為每個來賓分配單獨的 IP:
IE:
192.168.1.1 192.168.1.2 192.168.1.3
ETC。
您可以使用 ifconfig 指令為介面設定正確的 IP:
ifconfig eth0 192.168.1.1 網路遮罩 255.255.255.0 向上
但是 - 如果您希望永久分配這些 IP - 您應該將它們新增至 /etc/network/interfaces 中。
例如這裡:
iface eth0 inet 靜態位址 192.168.1.1 網路遮罩 255.255.255.0
(如果需要,您也可以新增適當的網關條目)
當然不一定是192.168.1.0/24