Wednesday, November 14, 2007

Cấu hình IP trong Windows bằng command line

- Xem thiết lập TCP/IP:
netsh interface ip show config

- xuất cấu hình ra file text:
netsh -c interface dump > c:\file.txt

- Nhập cấu hình từ file txt:
netsh –f c:\file.txt
Hoặc: netsh exec c:\file.txt

- Cấu hình:
netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

- Nạp cấu hình động:
netsh interface ip set address "Local Area Connection" dhcp

- Cấu hình DNS:
netsh interface ip set dns "Local Area Connection" static 192.168.0.200

- Cấu hình DNS tự động:
netsh interface ip set dns "Local Area Connection" dhcp

- Cấu hình WINS:
netsh interface ip set wins "Local Area Connection" static 192.168.0.200

vd1:
netsh interface ip set address name="Local Area Connection" static 10.151.121.99 255.255.255.0 10.151.121.1 1
netsh interface ip set dns "Local Area Connection" static 203.162.4.191
netsh interface ip set wins "Local Area Connection" static 203.162.4.191

vd2:
netsh interface ip set address name="Local Area Connection" source=static addr=10.151.121.99 mask=255.255.255.0
netsh interface ip set address name="Local Area Connection" gateway=10.151.121.1 gwmetric=1
netsh interface ip set dns name="Local Area Connection" source=static addr=203.162.4.191 register=PRIMARY
netsh interface ip add dns name="Local Area Connection" addr=203.162.4.190 index=2
netsh interface ip set wins name="Local Area Connection" source=static addr=203.162.4.191

vd3:
set address name="Local Area Connection" source=dhcp
set dns name="Local Area Connection" source=dhcp register=PRIMARY
set wins name="Local Area Connection" source=dhcp

No comments: