2. Khởi động lại card mạng để thay đổi có hiệu lực
1
2
3
4
| root@fw:~# /etc/init.d/networking restart * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces * Reconfiguring network interfaces... [ OK ]root@fw:~# |
3. Xem kết quả thế nào
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| root@fw:~# ifconfigeth0 Link encap:Ethernet HWaddr 00:0c:29:30:8a:f5 inet addr:10.0.0.3 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe30:8af5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:861 errors:0 dropped:0 overruns:0 frame:0 TX packets:121 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81138 (81.1 KB) TX bytes:16881 (16.8 KB) Interrupt:19 Base address:0x2000lo 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:16436 Metric:1 RX packets:64 errors:0 dropped:0 overruns:0 frame:0 TX packets:64 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4832 (4.8 KB) TX bytes:4832 (4.8 KB) |
Mỗi máy tính cần có một IP để giao tiếp trong mạng, Windows hay Linux cũng thế cả.
1. Thiết lập IP tĩnh cho mạng, mình dùng trình soạn thảo vi để edit file cấu hình.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| [root@fw:~# vi /etc/network/interfaces# The primary network interfaceauto eth0iface eth0 inet staticaddress 10.0.0.3netmask 255.255.255.0network 10.0.0.0broadcast 10.0.0.255gateway 10.0.0.2# dns-* options are implemented by the resolvconf package, if installeddns-nameservers 10.0.0.2dns-search mangmaytinhxyz.com |
- Dòng 1: Dùng vi sửa file cấu hình interface, một số người còn gọi là card mạng nhìn chung cũng rưa rứa nhau, tiếng việt phong phú ^^
- Dòng 4: Tên interface là eth0
- Dòng 5: Khai báo sẽ gán IP tĩnh cho interface này
- Dòng 6: Chỉ định IP cho interface là 10.0.0.3
- Dòng 7: Subnet mask của IP
- Dòng 8: IP thuộc mạng 10.0.0.0
- Dòng 9: Địa chỉ Broadcast
- Dòng 10: Default Gateway, thường là IP LAN của modem ADSL
- Dòng 13: IP của DNS Server
- Dòng 14: Ưu tiên tìm trong miền mangmaytinhxyz.com
- Dòng 4: Tên interface là eth0
- Dòng 5: Khai báo sẽ gán IP tĩnh cho interface này
- Dòng 6: Chỉ định IP cho interface là 10.0.0.3
- Dòng 7: Subnet mask của IP
- Dòng 8: IP thuộc mạng 10.0.0.0
- Dòng 9: Địa chỉ Broadcast
- Dòng 10: Default Gateway, thường là IP LAN của modem ADSL
- Dòng 13: IP của DNS Server
- Dòng 14: Ưu tiên tìm trong miền mangmaytinhxyz.com