Http://www.linuxidc.com/Linux/2010-03/24820p3.htm
# Sort by online materials
# Method 1 and method 4 verified
# Anything the matter, please contact: asksamuel@sina.com
Directory
Method 1: The NIC automatically obtains the IP address through DHCP
Method 2: static IP Address Allocation for NICs
Method 3: pppoe broadband dialing Configuration
Method 4: connect to the Internet through a wireless LAN
Method 1: The NIC automatically obtains the IP address through DHCP
$ Sudo gedit/etc/Network/interfaces
# Modify the file/etc/Network/interfaces as follows:
#-------------------------------------------------------------------------------
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).
#
# The loopback network interface (configure the loopback interface)
Auto lo # auto lo Interface
Iface lo Inet loopback # configure the lo interface as the loopback Port
# The primary network interface (configure the primary network interface)
Auto eth0 # enable the eth0 interface automatically upon startup
Iface eth0 Inet DHCP # Set the eth0 interface to DHCP for Automatic Acquisition
#-------------------------------------------------------------------------------
$ Sudo/etc/init. d/networking restart # restart the network
Method 2: static IP Address Allocation for NICs
$ Sudo gedit/etc/Network/interfaces
# Modify the file/etc/Network/interfaces as follows:
#-------------------------------------------------------------------------------
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).
#
# The loopback network interface (configure the loopback interface)
Auto lo # auto lo Interface
Iface lo Inet loopback # configure the lo interface as the loopback Port
# The primary network interface (configure the primary network interface)
Auto eth0 # enable the eth0 interface automatically upon startup
Iface eth0 Inet static # configure the eth0 interface as the static IP Address
Address 10.16.3.99
Netmask 255.255.255.0
Network 10.16.3.0
Broadcast 10.16.3.255
Gateway 10.16.3.1
######################################## ############
# DNS-* options are implemented by the resolvconf package, if installed (DNS settings)
# DNS-nameservers 61.153.177.196 61.153.177.197
# DNS-search fireteam.org
######################################## ############
# Sudo gedit/etc/resolv. conf
# Set DNS server (multiple DNS servers can be set)
# Nameserver 192.168.1.1
######################################## ############
#-------------------------------------------------------------------------------
$ Sudo/etc/init. d/networking restart # restart the network
Method 3: pppoe broadband dialing Configuration
Initial Dialing:
Application-System Tools-terminal open a terminal and enter the following command:
Sudo pppoeconf
The system starts to search for the ADSL modem on all network interfaces. Step by step, yes.
│ Please enter the username which you usually need for │
│ The PPP login to your provider in the input box below. │
│ If you wish to see the help screen, delete the │
│ Username and press OK. │
Enter your bandwidth account.
Enter the password.
Tip: For a pppoe broadband account provided by Henan Netcom, enter the encrypted user name.
Wocould you like to add these addresses automatically to the list of nameservers
In your local/etc/resolv. conf file? (Recommended)
Whether to automatically obtain DNS. Select Yes.
Shocould pppoe clamp MSS at 1452 bytes? If unsure, say yes.
Set the packet length. If you are not sure about the length, select Yes
Your pppd is configured now. wocould you like to start the connection
Boot time?
Is ADSL automatically activated at startup? Let's take a look.
In the future, you need to manually dial, open the terminal, and enter the command:
Sudo Pon DSL-provider
Generally, after one dial-through, you can log on to Ubuntu
It will automatically dial the Internet. You do not need to enter the command to dial each time.
Manual disconnection:
Sudo poff
View connection information:
Plog and ifconfig ppp0
Ifconfig ppp0 can be used to query the Internet IP address of the local machine.
Method 4: connect to the Internet through a wireless LAN
Requires that a wireless local Nic be installed with a drive
1. Insert a wireless network card
Check the network settings to see if two more devices exist.
$ Ifconfig
Eth0 link encap: Ethernet hwaddr 00: 24: 7e: 14: A9: A8
Inet6 ADDR: fe80: 224: 7eff: fe14: a9a8/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 11998024 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 13667166 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX Bytes: 1069420740 (1.0 GB) TX Bytes: 3776606487 (3.7 GB)
Memory: fc200000-fc220000
Eth0: avahi link encap: Ethernet hwaddr 00: 24: 7e: 14: A9: A8
Inet ADDR: 169.254.7.73 bcast: 169.254.255.255 mask: 255.255.0.0
Up broadcast running Multicast MTU: 1500 Metric: 1
Memory: fc200000-fc220000
Lo 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: 66657 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 66657 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 6372151 (6.3 MB) TX Bytes: 6372151 (6.3 MB)
Ppp0 link encap: Point-to-Point Protocol
Inet ADDR: 123.10.130.147 p-t-P: 123.10.128.1 mask: 255.255.255.255
Up pointopoint running noarp multicast MTU: 1492 Metric: 1
RX packets: 149828 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 122796 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 3
RX Bytes: 150170347 (150.1 MB) TX Bytes: 16349467 (16.3 MB)
Wlan0 link encap: Ethernet hwaddr 00: 22: Fa: 94: 48: 56
Up broadcast multicast MTU: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 0 (0.0 B) TX Bytes: 0 (0.0 B)
Wmaster0 link encap: unspec hwaddr 00-22-fa-94-48-56-00-00-00-00-00-00-00-00-00-
00-00
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 0 (0.0 B) TX Bytes: 0 (0.0 B)
As long as you see eth0, it indicates that the NIC device has been set separately. eth0 is the name of the wireless Nic device.
2. Confirm the model of the wireless network card.
$ Lspci
......
00:19. 0 Ethernet controller: Intel Corporation 82567lm gigabit network
Connection (Rev 03)
......
The above Intel Corporation 82567lm gigabit network connection (Rev 03) is a wireless Nic chip.
.
3. Power on the wireless network card
$ Sudo iwconfig eth0 txpower on
4. Search for wireless networks in a region
$ Iwlist eth0 Scan
Eth0 scan completed:
Cell 01-Address: 00: 1D: 0f: 4d: 8B: e4
Essid: "TP-LINK"
Mode: Master
Frequency: 2.437 GHz (Channel 6)
Quality = 28/70 signal level =-67 dBm noise level =-95 dBm
Encryption key: Off
Bit Rates: 1 Mb/s, 2 Mb/s, 5.5 Mb/s, 11 Mb/s, and 6 MB/S
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 MB/S
48 Mb/s; 54 MB/S
Extra: bcn_int = 100.
Extra: ath_ie = dd0900037f01010008ff7f
Cell 02-Address: 00: 21: 27: 3A: 37: 0a
Essid: "TP-LINK"
Mode: Master
Frequency: 2.437 GHz (Channel 6)
Quality = 12/70 signal level =-83 dBm noise level =-95 dBm
Encryption key: On
Bit Rates: 1 Mb/s, 2 Mb/s, 5.5 Mb/s, 11 Mb/s, and 6 MB/S
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 MB/S
48 Mb/s; 54 MB/S
Extra: bcn_int = 100.
Extra: ath_ie = dd0900037f01010008ff7f
Cell 03-Address: 00: 18: 39: A6: 98: E2
Essid: "Linksys"
Mode: Master
Frequency: 2.437 GHz (Channel 6)
Quality = 3/70 signal level =-92 dBm noise level =-95 dBm
Encryption key: On
Bit Rates: 1 Mb/s, 2 Mb/s, 5.5 Mb/s, 11 Mb/s, and 6 MB/S
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 MB/S
48 Mb/s; 54 MB/S
Extra: bcn_int = 100.
IE: WPA version 1
Group cipher: CCMP
Pairwise ciphers (1): CCMP
Authentication suites (1): PSK
I have three Wireless AP nearby, Essid marked the name of the Wireless AP, two of which are called TP-LINK, the other is called
Linksys: write down the names of these wireless APs. I will try again later.
5. connect to a Wireless AP
$ Sudo iwconfig ATH0 Essid "Linksys"
$ Ifconfig
No prompt is provided whether connected or not. You need to run the command to check whether connected or not.
$ Iwconfig eth0
Eth0 IEEE 802.11g Essid: "Linksys" nickname :""
Mode: managed frequency: 2.462 GHz Access Point: Not-associated
Bit Rate: 0 kb/s TX-Power: 18 dBm sensiti.pdf = 1/1
Retry: Off RTS thr: Off fragment thr: Off
Power Management: Off
Link quality = 0/70 signal level =-95 dBm noise level =-95 dBm
RX invalid nwid: 8172 RX invalid crypt: 0 RX invalid frag: 0
TX excessive retries: 0 invalid MISC: 0 missed Beacon: 0
The section in the black text above indicates that the connection is not successful, and it doesn't matter if you change another one.
$ Sudo iwconfig eth0 Essid "TP-LINK"
$ Ifconfig
Check the access status after execution.
$ Iwconfig eth0
Eth0 IEEE 802.11g Essid: "TP-LINK" nickname :""
Mode: managed frequency: 2.437 GHz Access Point: 00: 1D: 0f: 4d: 8B: e4
Bit Rate: 36 Mb/s TX-Power: 18 dBm sensiti.pdf = 1/1
Retry: Off RTS thr: Off fragment thr: Off
Power Management: Off
Link quality = 26/70 signal level =-69 dBm noise level =-95 dBm
RX invalid nwid: 8268 RX invalid crypt: 0 RX invalid frag: 0
TX excessive retries: 0 invalid MISC: 0 missed Beacon: 0
OK. It is connected.
Note: If you need a password to connect to the AP, and you do know the password of the AP, you can use the following method to connect
For example, if the password is 123456789, the four digits must be separated.
$ Sudo iwconfig ATH0 Essid "TP-LINK" Key 1234-5678-9
6. enable wireless Nic
$ Sudo ifconfig ATH0 up
7. Set the wireless network card to use DHCP to automatically obtain the IP address
$ Sudo dhclient ATH0
Internet Systems Consortium DHCP Client v3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wifi0: Unknown hardware address type 801
Wifi0: Unknown hardware address type 801
Listening on LPF/ATH0/00: 19: E0: 85: 73: 70
Sending on LPF/ATH0/00: 19: E0: 85: 73: 70
Sending on socket/fallback
Dhcpdiscover on ATH0 to transmit 255.255.255 port 67 interval 6
Dhcpoffer of 192.168.1.104 from 192.168.1.1
Dhcprequest of 192.168.1.104 on ATH0 to 255.255.255 port 67
Dhcpack of 192.168.1.104 from 192.168.1.1
Bound to 192.168.1.104 -- renewal in 3125 seconds.
Now you can unplug the network cable and use the wireless network card to access the Internet.
8. Disconnect the network
To disconnect the network, run the following command:
$ Sudo ifconfig ATH0 down