Tyler Chris - Fedora Linux стр 25.

Шрифт
Фон

172.16.97.0 * 255.255.255.0 U 0 0 0 eth0

default 172.16.97.254 0.0.0.0 UG 0 0 0 eth0

Notice that two routes have been configured. The first one states that local machines (those with IP addresses starting with 172.16.97) can be reached directly on the local network (gateway * and no G in the Flags column), and the second entry states that packets destined to any other IP address are to be sent through the router 172.16.97.254 (which is on the local network and therefore directly reachable).

The default route can be removed and added back in, pointing to a different gateway/router:

# route delete default

# route add default gw 172.16.97.253

# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

172.16.97.0 * 255.255.255.0 U 0 0 0 eth0

default 172.16.97.253 0.0.0.0 UG 0 0 0 eth0

When the wlan0 interface is configured, a new route is added for hosts directly accessible through that interface:

# ifconfig wlan0192.168.9.37

# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

172.16.97.0 * 255.255.255.0 U 0 0 0 eth0

192.168.9.0 * 255.255.255.0 U 0 0 0 wlan0

default 172.16.97.253 0.0.0.0 UG 0 0 0 eth0

If other networks are available through additional gateways, these can be configured by using route with the -net and netmask arguments. For example, if your corporate network 10.x.x.x in London were accessible through the gateway 192.168.9.1 on your wireless network, you could configure the route with this command:

# route add -net 10.0.0.0netmask 255.0.0.0gw 192.168.9.1

# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

172.16.97.0 * 255.255.255.0 U 0 0 0 eth0

192.168.9.0 * 255.255.255.0 U 0 0 0 wlan0

10.0.0.0 192.168.9.1 255.0.0.0 UG 0 0 0 wlan0

default 172.16.97.253 0.0.0.0 UG 0 0 0 eth0

3.2.1.3.3. DNS and hostnames

/etc/resolv.conf

search fedorabook.com oreilly.com

nameserver 127.0.0.1

nameserver 216.183.93.224

There are three common option keywords used in this file:

search

A space- or tab-delimited list of domains to be searched when attempting to resolve a hostname without a domain component. In this example, if the DNS resolver were given the hostname bluesky , it would attempt to resolve the hostname bluesky.fedorabook.com , and if that failed, it would attempt to resolve bluesky.oreilly.com . There is a limit of six domains in the search list.

domain

A rarely used alternative to search that can specify

# modprobe zd1201

After pausing for a moment to permit the interface to be configured, you can view /var/log/ messages and the output of ifconfig to see whether the driver loaded successfully and brought up the interface:

# tail -50/var/log/messages

...(Lines snipped)...

Jun 29 04:25:58 beige kernel: usbcore: deregistering driver zd1201

Jun 29 04:26:04 beige kernel: usb 2-1: wlan0: ZD1201 USB Wireless interface

Jun 29 04:26:04 beige kernel: usbcore: registered new driver zd1201

Jun 29 04:26:05 beige dhclient: DHCPREQUEST on eth1 to 255.255.255.255 port 67

Jun 29 04:26:10 beige dhclient: DHCPREQUEST on eth1 to 255.255.255.255 port 67

Jun 29 04:26:11 beige dhclient: DHCPACK from 172.16.97.254

Jun 29 04:26:11 beige NET[15776]: /sbin/dhclient-script : updated /etc/resolv.conf

Jun 29 04:26:11 beige dhclient: bound to 172.16.97.101 -- renewal in 39113 seconds.

# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0D:56:33:D7:18

inet addr:172.16.97.100 Bcast:172.16.97.255 Mask:255.255.255.0

inet6 addr: fe80::20d:56ff:fe33:d718/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:18181 errors:0 dropped:0 overruns:0 frame:0

TX packets:3263 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:2561730 (2.4 MiB) TX bytes:375878 (367.0 KiB)

Interrupt:177

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:4936 errors:0 dropped:0 overruns:0 frame:0

TX packets:4936 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2973825 (2.8 MiB) TX bytes:2973825 (2.8 MiB)

wlan0 Link encap:Ethernet HWaddr 00:0C:2D:00:2B:DB

inet addr:172.16.97.101 Bcast:172.16.97.255 Mask:255.255.255.0

inet6 addr: fe80::20c:2dff:fe00:2bdb/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:10 errors:0 dropped:0 overruns:0 frame:0

TX packets:13 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1026 (1.0 KiB) TX bytes:2384 (2.3 KiB)

3.2.1.5. Using private networks

port forwarding

Table 3-2. Private network address pools

Address rangeAvailable IP addressesTreatment using default netmask
10.0.x.x16,777,216One Class A network of 16,777,216 addresses
172.16.x.x172.31.x.x1,048,57616 class B networks of 65,536 addresses each
192.168.x.x65,536256 class C networks of 256 addresses each

Ваша оценка очень важна

0
Шрифт
Фон

Помогите Вашим друзьям узнать о библиотеке