當前位置:首頁 » 操作系統 » linux寬頻

linux寬頻

發布時間: 2023-08-17 20:32:40

linux系統下怎麼連接網路

linux系統下連網路,操作步驟如下:

1、首先用root用戶登錄linux桌面系統。

⑵ linux如何看網路帶寬

使用命令:mii-tool -v
mii:是Linux下專門設置網卡工作模式的命令,詳細參數如下
1. 查看網卡的工作模式,輸入命令:
#mii-tool -v
eth0: negotiated 100baseTx-FD, link ok
proct info: vendor 00:aa:00, model 56 rev 0
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
從以上信息中可以看出,這塊網卡工作在100M全雙工自適應模式下,「100BaseTx-FD」意為100M Full Duplex。
2. 更改網卡的工作模式,輸入命令:
#mii-tool -F media [interface]
media可選的模式有100baseTx-FD、100baseTx-HD、10baseT-FD、10baseT-HD等。 Interface代表所選擇的網卡,如eth0、eth1等,默認為eth0。
例如,設置網卡工作在10M半雙工模式下,輸入命令:
#mii-tool -F 10baseT-HD eth0
3. 恢復網卡的自適應工作模式,輸入命令:
#mii-tool -r eth0
更詳細的使用方法可以用mii-tool -h來獲得。

⑶ Linux 系統怎麼用電信寬頻撥號上網

(1)安裝的前提條件

<1>確保安裝了網卡並工作正常

使用命令
#ifconfig eth0
查看網卡狀態

<2>在系統中不要設置默認路由(網關),讓ADSL撥號後自動獲得

如果已經設置了默認路由,使用以下方法刪除:
在文件 /etc/sysconfig/network/ifconfig-eth0 中刪除 GATEWAY= 這一行,然後以root執行:

# service network restart

<3>已經安裝了pppd軟體包

如果存在文件 /usr/sbin/pppd,則說明已經安裝了pppd; 如果未安裝,下載安裝這個軟體包。

(2)安裝PPPOE客戶端軟體

Linux下的PPPOE客戶端軟體比較多,而且大多使用GNU License,我們推薦使用rp-pppoe
這個軟體包。從http://www.roaringpenguin.com/procts/pppoe這個網站上,不僅可以下載
各發布包下的rp-pppoe的二進制軟體包,而且可以下載源代碼軟體包。

我們使用centos下的yum安裝方法,來安裝rp-pppoe軟體包
#yum install rp-pppoe

(3)配置PPPOE客戶端軟體

<1>配置文件

安裝完軟體包後,必須配置PPPOE的配置文件/etc/ppp/pppoe.conf,從而讓ADSL撥號時使用配置文件中的用戶名、密碼等參數。

<2>命令配置
# adsl-setup ← 建立ADSL連接

Welcome to the ADSL client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly...

LOGIN NAME

Enter your Login Name (default root): ← 填入ADSL連接的用戶名

INTERFACE

Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0): ← 指定網路接入設備,一塊網卡的情況下,一般為默認eth0

Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
Enter the demand value (default no): ← 直接按回車,接受默認設置

DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here: ← 如果知道DNS伺服器的信息在此填入。不知道的情況按回車跳過

PASSWORD

Please enter your Password: ← 輸入ADSL的連接密碼
Please re-enter your Password: ← 再次確認輸入ADSL的連接密碼

USERCTRL

Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): no ← 填入no,不允許一般用戶控制PPPoE的連接

FIREWALLING

Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.

The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2): 0 ← 輸入0,不在這里使用防火牆

Start this connection at boot time

Do you want to start this connection at boot time?
Please enter no or yes (default no): yes ← 填入yes,在系統啟動時自動連接ADSL

** Summary of what you entered **

Ethernet Interface: eth0
User name: [email protected]
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: no
Accept these settings and adjust configuration files (y/n)? y ← 配置信息確認無誤後,鍵入y同意設置
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)

?

Congratulations, it should be all set up!

Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.

(4)啟動PPPOE客戶端軟體
# adsl-start ← 啟動ADSL連接
# ← 稍等片刻後若啟動成功後出現提示符(無任何提示或Connected意味著連接成功)

如果不成功,請檢查網線、ADSL MODEM等物理設備,並查看 /var/log/messages中的信息
/usr/sbin/adsl-stop 關閉和ISP的連接
/usr/sbin/adsl-status 查看當前連接的狀態

如果想在Linux系統啟動時自動啟動ADSL連接,輸入以下命令
#chkconfig --add adsl
將在當前的運行級下加入ADSL的自啟動腳本

(5)測試
當連接成功後,使用命令 #ifconfig -a 在輸出中應該含有關於 ppp0 的一堆信息,其中還綁定了 IP 地址,說明已經從撥號中獲 得了IP地址。使用命令 #netstat -nr 查看路由表信息,這時的默認路由應該是上面獲得的IP地址。 如果沒有默認路由,我們可以手動增加: #route add default gw 上面獲得的IP地址使用命令#nslookup www.sina.com.cn 如果解析出新浪的IP,說明已經從撥號中正確獲得了DNS伺服器最後,使用命令ping某個域名或IP,如果有響應,表示你已經大功告成了。

⑷ linux 如何連接寬頻

奇怪,我設置好DSL連接後直接在桌面最上方面板右側鍵盤(輸入法)左邊的那個信號發射的圖標上點擊選擇DSL連接就能上網的,不需要再在其它地方設置了?
要不然你在「應用程序」
→「附件」→
「終端」中輸入命令
sudo
pppoeconf
設置一下,看能不能上網。
還有ubuntu
10.04
下單個窗口抓圖可以直接按Alt+PrintScreen,抓取整個屏幕按PrintScreen鍵。

⑸ linux下配置網路連接

linux 命令配置網路連接首先,先了解傳統的網路設置命令:
1. 使用ifconfig命令設置並查看網路介面情況
示例1: 設置eth0的IP,同時激活設備:
# ifconfig eth0 192.168.4.1 netmask 255.255.255.0 up
示例2: 設置eth0別名設備 eth0:1 的IP,並添加路由
# ifconfig eth0:1 192.168.4.2
# route add ?host 192.168.4.2 dev eth0:1
示例3:激活(禁用)設備
# ifconfig eth0:1 up(down)
示例4:查看所有(指定)網路介面設置
# ifconfig (eth0)
2. 使用route 命令設置路由表
示例1:添加到主機路由
# route add ?host 192.168.4.2 dev eth0:1
# route add ?host 192.168.4.1 gw 192.168.4.250
示例2:添加到網路的路由
# route add ?net IP netmask MASK eth0
# route add ?net IP netmask MASK gw IP
# route add ?net IP/24 eth1
示例3:添加默認網關
# route add default gw IP
示例4:刪除路由
# route del ?host 192.168.4.1 dev eth0:1
示例5:查看路由信息
# route 或 route -n (-n 表示不解析名字,列出速度會比route 快)
3.ARP 管理命令
示例1:查看ARP緩存
# arp
示例2: 添加
# arp ?s IP MAC
示例3: 刪除
# arp ?d IP
4. ip是iproute2軟體包裡面的一個強大的網路設置工具,他能夠替代一些傳統的網路管理工具。例如:ifconfig、route等,
上面的示例完萬能用下面的ip命令實現,而且ip命令能實現更多的功能.下面介紹一些示例:
4.0 ip命令的語法
ip命令的用法如下:
ip [OPTIONS] OBJECT [COMMAND [ARGUMENTS]]
4.1 ip link set--改動設備的屬性. 縮寫:set、s
示例1:up/down 起動/關閉設備。
# ip link set dev eth0 up
這個等於傳統的 # ifconfig eth0 up(down)
示例2:改動設備傳輸隊列的長度。
參數:txqueuelen NUMBER或txqlen NUMBER
# ip link set dev eth0 txqueuelen 100
示例3:改動網路設備MTU(最大傳輸單元)的值。
# ip link set dev eth0 mtu 1500
示例4: 修改網路設備的MAC地址。
參數: address LLADDRESS
# ip link set dev eth0 address 00:01:4f:00:15:f1
4.2 ip link show--顯示設備屬性. 縮寫:show、list、lst、sh、ls、l
-s選項出現兩次或更多次,ip會輸出更為周詳的錯誤信息統計。
示例:
# ip -s -s link ls eth0
eth0: mtu 1500 qdisc cbq qlen 100
link/ether 00:a0:cc:66:18:78 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
2449949362 2786187 0 0 0 0
RX errors: length crc frame fifo missed
0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
178558497 1783946 332 0 332 35172
TX errors: aborted fifo window heartbeat
0 0 0 332
這個命令等於傳統的 ifconfig eth0
5.1 ip address add--添加一個新的協議地址. 縮寫:add、a
示例1:為每個地址設置一個字元串作為標簽。為了和Linux-2.0的網路別名兼容,這個字元串必須以設備名開頭,接著一個冒號,
# ip addr add local 192.168.4.1/28 brd + label eth0:1 dev eth0
示例2: 在乙太網介面eth0上增加一個地址192.168.20.0,掩碼長度為24位(155.155.155.0),標准廣播地址,標簽為eth0:Alias:
# ip addr add 192.168.4.2/24 brd + dev eth1 label eth1:1
這個命令等於傳統的: ifconfig eth1:1 192.168.4.2
5.2 ip address delete--刪除一個協議地址. 縮寫:delete、del、d
# ip addr del 192.168.4.1/24 brd + dev eth0 label eth0:Alias1
5.3 ip address show--顯示協議地址. 縮寫:show、list、lst、sh、ls、l
# ip addr ls eth0
5.4.ip address flush--清除協議地址. 縮寫:flush、f
示例1 : 刪除屬於私網10.0.0.0/8的所有地址:
# ip -s -s a f to 10/8
示例2 : 取消所有乙太網卡的IP地址
# ip -4 addr flush label "eth0"
6. ip neighbour--neighbour/arp表管理命令
縮寫 neighbour、neighbor、neigh、n
命令 add、change、replace、delete、fulsh、show(或list)
6.1 ip neighbour add -- 添加一個新的鄰接條目
ip neighbour change--修改一個現有的條目
ip neighbour replace--替換一個已有的條目
縮寫:add、a;change、chg;replace、repl
示例1: 在設備eth0上,為地址10.0.0.3添加一個permanent ARP條目:
# ip neigh add 10.0.0.3 lladdr 0:0:0:0:0:1 dev eth0 nud perm
示例2:把狀態改為reachable
# ip neigh chg 10.0.0.3 dev eth0 nud reachable
6.2.ip neighbour delete--刪除一個鄰接條目
示例1:刪除設備eth0上的一個ARP條目10.0.0.3
# ip neigh del 10.0.0.3 dev eth0
6.3.ip neighbour show--顯示網路鄰居的信息. 縮寫:show、list、sh、ls
示例1: # ip -s n ls 193.233.7.254
193.233.7.254. dev eth0 lladdr 00:00:0c:76:3f:85 ref 5 used 12/13/20 nud reachable
6.4.ip neighbour flush--清除鄰接條目. 縮寫:flush、f
示例1: (-s 能顯示周詳信息)
# ip -s -s n f 193.233.7.254
7. 路由表管理
7.1.縮寫 route、ro、r
7.5.路由表
從Linux-2.2開始,內核把路由歸納到許多路由表中,這些表都進行了編號,編號數字的范圍是1到255。另外,
為了方便,還能在/etc/iproute2/rt_tables中為路由表命名。
默認情況下,所有的路由都會被插入到表main(編號254)中。在進行路由查詢時,內核只使用路由表main。
7.6.ip route add -- 添加新路由
ip route change -- 修改路由
ip route replace -- 替換已有的路由
縮寫:add、a;change、chg;replace、repl
示例1: 設置到網路10.0.0/24的路由經過網關193.233.7.65
# ip route add 10.0.0/24 via 193.233.7.65
示例2: 修改到網路10.0.0/24的直接路由,使其經過設備mmy
# ip route chg 10.0.0/24 dev mmy
示例3: 實現鏈路負載平衡.加入預設多路徑路由,讓ppp0和ppp1分擔負載(注意:scope值並非必需,他只不過是告訴內核,
這個路由要經過網關而不是直連的。實際上,如果你知道遠程端點的地址,使用via參數來設置就更好了)。
# ip route add default scope global nexthop dev ppp0 nexthop dev ppp1
# ip route replace default scope global nexthop dev ppp0 nexthop dev ppp1
示例4: 設置NAT路由。在轉發來自192.203.80.144的數據包之前,先進行網路地址轉換,把這個地址轉換為193.233.7.83
# ip route add nat 192.203.80.142 via 193.233.7.83
示例5: 實現數據包級負載平衡,允許把數據包隨機從多個路由發出。weight 能設置權重.
# ip route replace default equalize nexthop via 211.139.218.145 dev eth0 weight 1 nexthop via 211.139.218.145 dev eth1 weight 1
7.7.ip route delete-- 刪除路由
縮寫:delete、del、d
示例1:刪除上一節命令加入的多路徑路由
# ip route del default scope global nexthop dev ppp0 nexthop dev ppp1
7.8.ip route show -- 列出路由
縮寫:show、list、sh、ls、l
示例1: 計算使用gated/bgp協議的路由個數
# ip route ls proto gated/bgp |wc
1413 9891 79010
示例2: 計算路由緩存裡面的條數,由於被緩存路由的屬性可能大於一行,以此需要使用-o選項
# ip -o route ls cloned |wc
159 2543 18707
示例3: 列出路由表TABLEID裡面的路由。預設設置是table main。TABLEID或是個真正的路由表ID或是/etc/iproute2/rt_tables文件定義的字元串,
或是以下的特別值:
all -- 列出所有表的路由;
cache -- 列出路由緩存的內容。
ip ro ls 193.233.7.82 tab cache
示例4: 列出某個路由表的內容
# ip route ls table fddi153
示例5: 列出默認路由表的內容
# ip route ls
這個命令等於傳統的: route
7.9.ip route flush -- 擦除路由表
示例1: 刪除路由表main中的所有網關路由(示例:在路由監視程式掛掉之後):
# ip -4 ro flush scope global type unicast
示例2:清除所有被克隆出來的IPv6路由:
# ip -6 -s -s ro flush cache
示例3: 在gated程式掛掉之後,清除所有的BGP路由:
# ip -s ro f proto gated/bgp
示例4: 清除所有ipv4路由cache
# ip route flush cache
*** IPv4 routing cache is flushed.
7.10 ip route get -- 獲得單個路由 .縮寫:get、g
使用這個命令能獲得到達目的地址的一個路由及他的確切內容。
ip route get命令和ip route show命令執行的操作是不同的。ip route show命令只是顯示現有的路由,而ip route get命令在必要時會派生出新的路由。
示例1: 搜索到193.233.7.82的路由
# ip route get 193.233.7.82
193.233.7.82 dev eth0 src 193.233.7.65 realms inr.ac cache mtu 1500 rtt 300
示例2: 搜索目的地址是193.233.7.82,來自193.233.7.82,從eth0設備到達的路由(這條命令會產生一條非常有意思的路由,這是一條到193.233.7.82的回環路由)
# ip r g 193.233.7.82 from 193.233.7.82 iif eth0
193.233.7.82 from 193.233.7.82 dev eth0 src 193.233.7.65 realms inr.ac/inr.ac
cache mtu 1500 rtt 300 iif eth0
8. ip route -- 路由策略資料庫管理命令
命令add、delete、show(或list)
注意:策略路由(policy routing)不等於路由策略(rouing policy)。
在某些情況下,我們不只是需要通過數據包的目的地址決定路由,可能還需要通過其他一些域:源地址、IP協議、傳輸層埠甚至數據包的負載。
這就叫做:策略路由(policy routing)。
8.5. ip rule add -- 插入新的規則
ip rule delete -- 刪除規則
縮寫:add、a;delete、del、d
示例1: 通過路由表inr.ruhep路由來自源地址為192.203.80/24的數據包
ip ru add from 192.203.80/24 table inr.ruhep prio 220
示例2:把源地址為193.233.7.83的數據報的源地址轉換為192.203.80.144,並通過表1進行路由
ip ru add from 193.233.7.83 nat 192.203.80.144 table 1 prio 320
示例3:刪除無用的預設規則
ip ru del prio 32767
8.7. ip rule show -- 列出路由規則
縮寫:show、list、sh、ls、l
示例1: # ip ru ls
0: from all lookup local
32762: from 192.168.4.89 lookup fddi153
32764: from 192.168.4.88 lookup fddi153
32766: from all lookup main
32767: from all lookup 253
9. ip maddress -- 多播地址管理
縮寫:show、list、sh、ls、l
9.3.ip maddress show -- 列出多播地址
示例1: # ip maddr ls mmy
9.4. ip maddress add -- 加入多播地址
ip maddress delete -- 刪除多播地址
縮寫:add、a;delete、del、d
使用這兩個命令,我們能添加/刪除在網路介面上監聽的鏈路層多播地址。這個命令只能管理鏈路層地址。
示例1: 增加 # ip maddr add 33:33:00:00:00:01 dev mmy
示例2: 查看 # ip -O maddr ls mmy
2: mmy
link 33:33:00:00:00:01 users 2 static
link 01:00:5e:00:00:01
示例3: 刪除 # ip maddr del 33:33:00:00:00:01 dev mmy
10.ip mroute -- 多播路由緩存管理
10.4. ip mroute show -- 列出多播路由緩存條目
縮寫:show、list、sh、ls、l
示例1:查看 # ip mroute ls
(193.232.127.6, 224.0.1.39) Iif: unresolved
(193.232.244.34, 224.0.1.40) Iif: unresolved
(193.233.7.65, 224.66.66.66) Iif: eth0 Oifs: pimreg
示例2:查看 # ip -s mr ls 224.66/16
(193.233.7.65, 224.66.66.66) Iif: eth0 Oifs: pimreg
9383 packets, 300256 bytes
11. ip tunnel -- 通道設置
縮寫tunnel、tunl
11.4.ip tunnel add -- 添加新的通道
ip tunnel change -- 修改現有的通道
ip tunnel delete -- 刪除一個通道
縮寫:add、a;change、chg;delete、del、d
示例1:建立一個點對點通道,最大TTL是32
# ip tunnel add Cisco mode sit remote 192.31.7.104 local 192.203.80.1 ttl 32
11.4.ip tunnel show -- 列出現有的通道
縮寫:show、list、sh、ls、l
示例1: # ip -s tunl ls Cisco
12. ip monitor和rtmon -- 狀態監視
ip命令能用於連續地監視設備、地址和路由的狀態。這個命令選項的格式有點不同,命令選項的名字叫做monitor,接著是操作對象:
ip monitor [ file FILE ] [ all | OBJECT-LIST ]
示例1: # rtmon file /var/log/rtmon.log
示例2: # ip monitor file /var/log/rtmon.log r

熱點內容
centos7編譯安裝php 發布:2025-03-10 18:32:48 瀏覽:493
電腦上什麼安卓模擬器 發布:2025-03-10 18:32:47 瀏覽:21
公司ftp傳輸文件 發布:2025-03-10 18:24:54 瀏覽:387
aspsql注入過濾 發布:2025-03-10 18:19:37 瀏覽:464
編譯表頻率 發布:2025-03-10 18:02:59 瀏覽:776
寶馬330多哪些配置 發布:2025-03-10 18:01:33 瀏覽:765
我的世界神奇寶貝最良心的伺服器 發布:2025-03-10 18:01:29 瀏覽:238
6有資料庫 發布:2025-03-10 17:55:05 瀏覽:31
如何看macbook配置參數 發布:2025-03-10 17:54:25 瀏覽:75
電腦打開b站找不到伺服器 發布:2025-03-10 17:44:04 瀏覽:135