2017-04-10 5 views
0

USB를 이더넷 어댑터로 가져 왔는데 이제는 한쪽은 raspberry pi 3에, 다른 쪽은 이더넷으로 연결했습니다. (그래서 두 세트를 설정할 수 있습니다 내 파이에 대한 IP 주소).라즈베리 파이 3에 여러 개의 IP 주소를 설정하는 방법

참고 : 내 이더넷 포트를 분리하고 이더넷 어댑터에 USB를 통해서만 연결하면 나는 또한 라즈베리 파이 3

내 이더넷 포트를 사용하고, 나는 통신 할 수 없습니다. USB- 이더넷 어댑터와 통신이 없다고 가정합니다. 내가 원하는 모두 아래 그림과 같이 IP 주소를 내가 을/etc/네트워크/인터페이스를 파일을 변경 한

그런 다음 한 번에 작업 :이은 ifconfig에서 내 출력이 터미널에서

auto eth0 
allow-hotplug eth0 
iface eth0 inet static 
address 192.168.147.146 
netmask 255.255.255.0 
gateway 192.168.147.255 

auto eth0:0 
allow-hotplug eth0:0 
iface eth0:0 inet static 
address 192.168.147.145 
netmask 255.255.255.0 

allow-hotplug wlan0 
iface wlan0 inet manual 
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 

allow-hotplug wlan1 
iface wlan1 inet manual 
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 

입니다 :

eth0  Link encap:Ethernet HWaddr b8:27:eb:0d:2b:28 
     inet addr:192.168.147.146 Bcast:192.168.147.255 Mask:255.255.255.0 
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
     RX packets:71565 errors:0 dropped:928 overruns:0 frame:0 
     TX packets:17901546 errors:0 dropped:0 overruns:0 carrier:0 
     collisions:0 txqueuelen:1000 
     RX bytes:6283723 (5.9 MiB) TX bytes:1220265483 (1.1 GiB) 

eth0:0 Link encap:Ethernet HWaddr b8:27:eb:0d:2b:28 
     inet addr:192.168.147.145 Bcast:192.168.147.255 Mask:255.255.255.0 
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 

lo  Link encap:Local Loopback 
     inet addr:127.0.0.1 Mask:255.0.0.0 
     UP LOOPBACK RUNNING MTU:65536 Metric:1 
     RX packets:910 errors:0 dropped:0 overruns:0 frame:0 
     TX packets:910 errors:0 dropped:0 overruns:0 carrier:0 
     collisions:0 txqueuelen:1 
     RX bytes:79976 (78.1 KiB) TX bytes:79976 (78.1 KiB) 

나에게 당신의 제안을 알려 주시기 바랍니다 .....

+0

닫으 투표 -하지 프로그래밍 질문입니다. – tink

+0

여러 IP 주소는 무엇이 필요합니까? 필요에 따라 동일한 네트워크 어댑터에 많은 다른 주소를 할당 할 수 있으므로 반드시 다른 어댑터가 필요하지는 않습니다. 또한 Raspberry Pi 3에는 WiFi가 내장되어 있으므로 어쩌면 도움이 될 수도 있습니다. –

답변

-2

귀하의 USB를에 이더넷 어댑터는 실제 네트워크 어댑터이지만 마치 가상 네트워크 어댑터 인 것처럼 설정했습니다.

변경 eth0를 시도 : 0 당신은/etc에서의 eth1에/네트워크/인터페이스

당신의 코드는 다음과 같이 보일 것이다 파일 :

auto eth0 
allow-hotplug eth0 
iface eth0 inet static 
address 192.168.147.146 
netmask 255.255.255.0 
gateway 192.168.147.255 

auto eth1 
allow-hotplug eth1 
iface eth1 inet static 
address 192.168.147.145 
netmask 255.255.255.0 

allow-hotplug wlan0 
iface wlan0 inet manual 
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 

allow-hotplug wlan1 
iface wlan1 inet manual 
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf