Ubuntu單網(wǎng)卡設(shè)置安裝雙interface和Stun server的方法
Ubuntu單網(wǎng)卡下如何設(shè)置雙interface和Stun server的安裝呢?下文給出了詳細(xì)的描述,具體內(nèi)容如下所述。
因?yàn)閟tun server需要同時(shí)監(jiān)聽(tīng)兩個(gè)entry(即兩對(duì)IP和PORT)進(jìn)行對(duì)NAT的檢測(cè),所以需要server需要兩個(gè)interface. 首先在Ubuntu上設(shè)置兩個(gè)虛擬的interface,因?yàn)橹挥幸粋€(gè)物理的interface,所以只能在這一個(gè)上進(jìn)行虛擬。編輯網(wǎng)絡(luò)interface文件/etc/network/interfaces, 如下: ====================================================
- # more interfaces
- auto lo
- iface lo inet loopback
- auto eth0:0 /*啟用虛擬iface0:0*/
- iface eth0:0 inet static /*設(shè)置此iface為靜態(tài)IP*/
- address 172.25.27.218
- netmask 255.255.255.0
- gateway 172.25.27.254 auto eth0:1
- iface eth:1 inet dhcp /*設(shè)置此iface為動(dòng)態(tài)獲取IP*
======================================================
然后重啟網(wǎng)絡(luò)配置
- sudo /etc/init.d/networking restart.
下載stun server的軟件stund_0.96_Aug13.gz,然后解壓。進(jìn)入stun安裝目錄,然后make就ok了。 ====================================================== :~
- # cd stund
- all
- # ./server -h
- STUN server version 0.96
- Usage:
- ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport] If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with
- ./server -v -h 10.0.1.150 -a 10.0.1.151
- STUN servers need two IP addresses and two ports, these can be specified with:
- -h sets the primary IP
- -a sets the secondary IP
- -p sets the primary port and defaults to 3478
- -o sets the secondary port and defaults to 3479
- -b makes the program run in the backgroud
- -m sets up a STERN server starting at port m
- -v runs in verbose mode #
===========================================================
啟動(dòng)就簡(jiǎn)單了,有-h提示,一目了然。
- -v -h 172.25.27.126 -a 172.25.27.218
總結(jié):
希望本文介紹的Ubuntu單網(wǎng)卡設(shè)置安裝雙interface和Stun server的方法能夠?qū)ψx者有所幫助,更多有關(guān)linux系統(tǒng)的知識(shí)還有待于讀者去探索和學(xué)習(xí)。