LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1213|回复: 17

求解CLI下的多无线网络配置

[复制链接]
发表于 2010-1-9 17:44:40 | 显示全部楼层 |阅读模式
笔记本经常带出去,在家一般用无线,想让它出去后搜索不到这个无线就不要浪费时间去尝试连接,并且我可以很方便的连接其它无线。

我不喜欢用wicd等GUI工具。
发表于 2010-1-9 18:25:22 | 显示全部楼层
我的github中的net-set就是了

  1. ##########/etc/network/interfaces###########

  2. # The loopback network interface

  3. auto lo
  4. iface lo inet loopback

  5. # The primary network interface

  6. auto eth0 # or allow-hotplug eth0
  7. iface eth0 inet static # or dhcp
  8. hwaddress ether xx:xx:xx:xx:xx:xx
  9. address xxx.xxx.xxx.xxx
  10. netmask 255.255.255.0
  11. gateway xxx.xxx.xxx.xxx
  12. dns-nameservers 8.8.8.8 8.8.4.4

  13. # The wireless network interface

  14. auto wlan0 # or allow-hotplug wlan0
  15. iface wlan0 inet static # or dhcp
  16. hwaddress ether xx:xx:xx:xx:xx:xx
  17. address xxx.xxx.xxx.xxx
  18. netmask 255.255.255.0
  19. gateway xxx.xxx.xxx.xxx
  20. dns-nameservers 8.8.8.8 8.8.4.4
  21. #WEP
  22. wireless-essid xxxx
  23. wireless-keymode open|restricted
  24. wireless-key 12345|s:ascii
  25. #WPA
  26. wpa-ssid xxxx
  27. wpa-driver wext
  28. wpa-psk plaintext|hexadecimal

  29. ###############/etc/resolv.conf###############

  30. # Google
  31. nameserver 8.8.8.8
  32. nameserver 8.8.4.4

  33. # OpenDNS

  34. nameserver 208.67.222.222
  35. nameserver 208.67.220.220

  36. #########/etc/ppp/peers/dsl-provider##########

  37. defaultroute
  38. replacedefaultroute

  39. ##################MAC-Change##################

  40. sudo ifconfig eth0 down

  41. sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

  42. sudo ifconfig eth0 up

  43. ############Make it in operation#############

  44. sudo /etc/init.d/networking restart

  45. ############Manual wired operation#############

  46. ifconfig eth0 up

  47. #DHCP

  48. dhclient eth0

  49. #Static

  50. ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0

  51. route add default gw xxx.xxx.xxx.xxx

  52. ##########Manual wireless operation###########


  53. ifconfig wlan0 up

  54. iwlist wlan0 scan

  55. #No encryption

  56. iwconfig wlan0 essid "ssid"

  57. #WEP

  58. iwconfig wlan0 essid "ssid" key 1234567890

  59. iwconfig wlan0 essid "ssid" key s:asciikey

  60. #WPA/WPA2

  61. wpa_passphrase [ssid] [passphrase] >> /etc/wpa_supplicant.conf

  62. wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

  63. #DHCP

  64. dhclient wlan0

  65. #Static

  66. ifconfig wlan0 xxx.xxx.xxx.xxx netmask 255.255.255.0

  67. route add default gw xxx.xxx.xxx.xxx
复制代码
回复 支持 反对

使用道具 举报

发表于 2010-1-9 20:53:38 | 显示全部楼层
说明一下,wicd不只有GUI。
还有 wicd-curses
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-10 01:43:31 | 显示全部楼层
这不是我想要的,wicd-curses也是要启动wicd服务的
回复 支持 反对

使用道具 举报

发表于 2010-1-10 08:20:15 | 显示全部楼层
Post by tocai;2063189
这不是我想要的,wicd-curses也是要启动wicd服务的


这正是我需要的,只需要后台启动就ok了。

当然要最简就自己写配置文件罗。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-10 10:39:48 | 显示全部楼层
我想要简洁的配置文件呀
回复 支持 反对

使用道具 举报

发表于 2010-1-10 12:57:50 | 显示全部楼层
Post by tocai;2063212
我想要简洁的配置文件呀


我连接网络的有线网口和无线网口都是写在脚本里, 默认的interfaces文件只写了几个kvm相关的配置. 需要用那个网络, 就执行那个脚本.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-11 04:25:11 | 显示全部楼层
Post by blue_stone;2063228
我连接网络的有线网口和无线网口都是写在脚本里, 默认的interfaces文件只写了几个kvm相关的配置. 需要用那个网络, 就执行那个脚本.


把你的脚本发出来看看呀
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-11 21:41:26 | 显示全部楼层
请高手把配置发出来看看
回复 支持 反对

使用道具 举报

发表于 2010-1-11 21:47:32 | 显示全部楼层
你就莫有看到我贴出来的编辑配置文件中的wlan0以及手动无线连接的命令么?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表