[熱情]

[진행중] 우분투에서 공유기 만들기 본문

카테고리 없음

[진행중] 우분투에서 공유기 만들기

rootkaien 2014. 7. 22. 17:37

소유하고 있는 USB 동글 

: Iptime N300U

: Realtek 8182



linux (ubuntu)에 iptime를 연결햇을때 로그

[46885.666598] usb 1-1.1: USB disconnect, device number 9
[46892.771556] usb 1-1.1: new high-speed USB device number 10 using ehci-pci
[46892.865998] usb 1-1.1: New USB device found, idVendor=0bda, idProduct=8178
[46892.866004] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[46892.866007] usb 1-1.1: Product: 802.11n WLAN Adapter
[46892.866010] usb 1-1.1: Manufacturer: Realtek
[46892.866013] usb 1-1.1: SerialNumber: 00e04c000001
[46892.866694] rtl8192cu: Chip version 0x11
[46892.946044] rtl8192cu: MAC address: 00:26:66:4f:35:0f
[46892.946051] rtl8192cu: Board Type 0
[46892.946320] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[46892.946368] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[46892.946658] ieee80211 phy6: Selected rate control algorithm 'rtl_rc'
[46892.947276] rtlwifi: wireless switch is on
[46892.977004] rtl8192cu: MAC auto ON okay!
[46893.013664] rtl8192cu: Tx queue select: 0x05
[46893.401479] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[46893.402015] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready 



 iptime N300U는 rtl8192cu드라이버를 사용한다. realtek에서는 해당 드라이버와 hostapd를 제공하고 있어 다운받아서 컴파일하여 사용하여야된다.

 참고사이트 : http://bogeskov.dk/UsbAccessPoint.html


br0 설정 


apt-get  update

apt-get install bridge-utils iw


vi  /etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan1
iface wlan1 inet dhcp
iface default inet dhcp


# Insert This For Wireless AP Mode
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan1 


dhcp 설정

apt-get install dnsmasq


vi /etc/dnsmasq.d/dhcp.conf

dhcp-range=192.168.100.100,192.168.100.200,255.255.255.0,12h
dhcp-option=option:router,192.168.100.1
dhcp-option=option:dns-server,192.168.100.1
dhcp-authoritative 


sudo service dnsmasq restart


Getting the "right" 8182cu driver

sudo apt-get install linux-headers-...

=> "uname -a " 명령어로 커널 버전을 확인하여 설치하면된다.


git clone https://github.com/dz0ny/rt8192cu.git
cd rt8192cu
make
sudo make install 


해당 파일을 만들고

vi /etc/modprobe.d/8192cu.conf

내용을 추가한다.

blacklist rtl8192cu


해달 파일을 만들고

/etc/NetworkManager/NetworkManager.conf


내용추가.  USB AP 맥어드레스를 적어준다.

[main]
plugins=ifupdown,keyfile


[keyfile]
unmanaged-devices=mac:64:66:xx:xx:xx:xx 



realtek 사이트에서 hostapd를 다운받아서 사용한다.

http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=48&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true#RTL8192CU



unzip RTL8192xC_USB_linux_*.zip
tar zxvf RTL8188C_8192C_USB_linux_*/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_*.tar.gz
cd wpa_supplicant_hostapd-0.8_*/hostapd/
make
sudo cp hostapd hostapd_cli /usr/local/sbin/ 



hostap.conf 만들기 

vi /etc/hostapd/hostapd.conf

테스트로 보안은 WPA2이고 비번은 8자리로  00000000 로 해서 진행

ssid=blue
wpa_passphrase=00000000

ctrl_interface=/var/run/hostapd
interface=wlan1
bridge=br0
driver=rtl871xdrv
hw_mode=g
channel=6
wpa=2

beacon_int=100
hw_mode=g
ieee80211n=1
wme_enabled=1
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
max_num_sta=8
wpa_group_rekey=86400 



실행은


hostapd /etc/hostapd/hostapd.conf



...

Comments