Kết nối internet và Ethernet với Odroid (qua Switch) và 1 card mạng kết nối internet

Cấu hình tham khảo:

Kết nối internet qua cable, với cổng RJ45 trên máy tính. Với kết nối này, đặt connection là DHCP, ví dụ dải địa chỉ IP là từ 134.59.129.0 ->...255.

Kết nối mạng Lan (Ethernet) với Odroid (qua 1 switch trung gian), dùng card mạng có 1 đầu là kết nối USB, 1 đầu là RJ45 (loại thường dùng cho Macbook. Với kết nối này, đặt fixed IP, ví dụ 192.168.0.20, cho groundstation computer.

Dùng lệnh route sẽ cho kết quả, ví dụ như sau:

lhnguyen@nguyenL520:~$ route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

default 134.59.129.254 0.0.0.0 UG 0 0 0 eth0

134.59.129.0 * 255.255.255.0 U 1 0 0 eth0

192.168.0.0 * 255.255.255.0 U 1 0 0 eth1

Dùng lệnh ifconfig sẽ cho kết qủa, ví dụ như sau:

lhnguyen@nguyenL520:~$ ifconfig

eth0 Link encap:Ethernet HWaddr 04:7d:7b:39:2a:9c

      inet addr:134.59.129.246  Bcast:134.59.129.255  Mask:255.255.255.0

      inet6 addr: fe80::67d:7bff:fe39:2a9c/64 Scope:Link

      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

      RX packets:228508 errors:0 dropped:9 overruns:0 frame:0

      TX packets:97172 errors:0 dropped:0 overruns:0 carrier:0

      collisions:0 txqueuelen:1000 

      RX bytes:250192749 \(250.1 MB\)  TX bytes:28255224 \(28.2 MB\)

eth1 Link encap:Ethernet HWaddr 00:1f:f3:8b:ef:ca

lo Link encap:Local Loopback

Trong trường hợp này, kết nối 2 mạng bình thường.

http://www.ubuntugeek.com/howto-add-permanent-static-routes-in-ubuntu.html

https://www.computerhope.com/unix/route.htm

https://www.thegeekstuff.com/2012/04/route-examples/

Một ví dụ bi lỗi kết nối Internet và cách khắc phục:

lhnguyen@nguyenL520:~$ route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

default nguyenL520 0.0.0.0 UG 0 0 0 eth1

134.59.129.0 * 255.255.255.0 U 1 0 0 eth1

192.168.0.0 * 255.255.255.0 U 1 0 0 eth0

lhnguyen@nguyenL520:~$ ifconfig

eth0 Link encap:Ethernet HWaddr 00:1f:f3:8b:ef:ca

eth1 Link encap:Ethernet HWaddr 04:7d:7b:39:2a:9c

lo Link encap:Local Loopback

Nếu quan sát kỹ, sẽ thấy thứ tự eth0 và eth1 bị đảo lộn. Cái này do khi kết nối mạng nào trước thì hệ thống sẽ assign địa chỉ tương ứng theo thứ tự kết nối.

Quan trọng hơn là :

lhnguyen@nguyenL520:~$ route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

default nguyenL520 0.0.0.0 UG 0 0 0 eth1

Gateway không phải là 134.59.129.254 như lúc đầu.

Làm thể nào để biết là gateway cần đặt là dãy số đó? (Cần tìm hiểu thêm)

Gỉả sử số đó là gateway cần đặt, khi đó cần xóa default cũ để thay bằng default mới.

Ví dụ:

sudo route del default gw nguyenL520

sudo route add default gw 134.59.129.254

========================================================

========================================================

Connect auv7530 with Ethernet (over ICY BOX usb-network hub) and Internet (over auv7530's network port)

Check route

Then, since cannot connect to the Internet

Now, check route again

and connection to the Internet works properly!

Last updated

Was this helpful?