转:ubuntu NFS

http://os.51cto.com/art/201001/176511.htm

对大家推荐很好使用的nfs服务系统之前,像让大家对Ubuntu nfs服务系统有所了解,然后对Ubuntu nfs服务系统全面讲解介绍,希望对大家有用配置Ubuntu nfs服务器,可见Ubuntu隶属于linux阵营。顺便问一句楼主既然没有文档何必一定要学ubuntu,还是学有文档的比较方便。

在Ubuntu下安装、配置Ubuntu nfs服务的步骤如下:

1、安装Ubuntu nfs
Ubuntu上默认是没有安装Ubuntu nfs服务器的,因此我们首先安装Ubuntu nfs服务器端:$sudo apt-get install nfs-kernel-server
在一些文档中,提出还需要使用apt-get来手动安装nfs的客户端nfs-common,以及端口映射器portmap,但其实这是没有必要的,因为在安装nfs-kernel-server时,apt会自动为我们把它们安装好。

2、配置/etc/exports
Ubuntu nfs允许挂载的目录及权限在文件/etc/exports中进行了定义。
例如,我们要将根目录下的rootfs目录共享出来,那么我们需要在/etc/exports文件末尾添加如下一行:/rootfs *(rw,sync,no_root_squash)
其 中:/rootfs是要共享的目录,*代表允许所有的网络段访问,rw是可读写权限,sync是资料同步写入内存和硬盘,no_root_squash是 Ubuntu nfs客户端分享目录使用者的权限,如果客户端使用的是root用户,那么对于该共享目录而言,该客户端就具有root权限。

其它Ubuntu nfs常用的参数有:
ro 只读访问
rw 读写访问sync 所有数据在请求时写入共享
async nfs在写入数据前可以响应请求
secure nfs通过1024以下的安全TCP/IP端口发送
insecure nfs通过1024以上的端口发送
wdelay 如果多个用户要写入nfs目录,则归组写入(默认)
no_wdelay 如果多个用户要写入nfs目录,则立即写入,当使用async时,无需此设置。
hide 在nfs共享目录中不共享其子目录
no_hide 共享nfs目录的子目录
subtree_check 如果共享/usr/bin之类的子目录时,强制nfs检查父目录的权限(默认)
no_subtree_check 和上面相对,不检查父目录权限
all_squash 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash 保留共享文件的UID和GID(默认)
root_squash root用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squas root用户具有根目录的完全管理访问权限
anonuid=xxx 指定nfs服务器/etc/passwd文件中匿名用户的UID
anongid=xxx 指定nfs服务器/etc/passwd文件中匿名用户的GID

3、Ubuntu nfs重启服务
$sudo /etc/init.d/portmap restart
$sudo /etc/init.d/nfs-kernel-server restart

4、测试Ubuntu nfs
此时可以运行以下命令来显示一下共享出来的目录:
$showmount -e
或者可以使用以下命令把它挂载在本地磁盘上,例如将/rootfs挂载到/mnt下:
$ sudo mount -t nfs localhost:/rootfs /mnt
可以运行df命令查看是否挂载成功。查看后可以使用以下命令卸载:
$ sudo umount /mnt

 

 

###########################

# eample #

sudo apt-get install nfs-kernel-server

cat /etc/exports

/data/download/iso *(ro,insecure,all_squash)

sudo service portmap restart

sudo /etc/init.d/nfs-kernel-server restart

showmount -e

mkdir /tmp/iso

sudo mount -t nfs 127.0.0.1:/data/download/iso /tmp/iso

setup Clonezilla live within PXE boot server

Download Clonezilla Live ISO image (Debian)

http://www.clonezilla.org/downloads.php

 

Create mount point inside PXE root directory

mkdir -p  /tftp/pxe/Clonezilla/amd64

mkdir -p  /tftp/pxe/Clonezilla/i386

 

Mount Clonezilla  ISO image as loop device

mount -o loop -r -n -t iso9660 /tftp/pxe/Clonezilla/amd64  ~/iso/clonezilla-live-2.2.4-12-amd64.iso

mount -o loop -r -n -t iso9660 /tftp/pxe/Clonezilla/i386  ~/iso/clonezilla-live-2.2.4-12-i686-pae.iso

 

Create PXE SubMenu for CloneZilla

DEFAULT /vesamenu.c32
TIMEOUT 600
PROMPT 0

Label  Clonezilla_amd64_install
kernel /Clonezilla/amd64/live/vmlinuz
APPEND initrd=/Clonezilla/amd64/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” keyboard-layouts=”” ocs_live_batch=”no” locales=”” vga=788 nosplash noprompt fetch=http://apt.zhenglei.net/Clonezilla/amd64/filesystem.squashfs

Label  Clonezilla_i686_install
kernel /Clonezilla/i686/live/vmlinuz
APPEND initrd=/Clonezilla/i686/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” keyboard-layouts=”” ocs_live_batch=”no” locales=”” vga=788 nosplash noprompt fetch=http://apt.zhenglei.net/Clonezilla/i686/filesystem.squashfs

 

Refer to:

http://www.clonezilla.org/clonezilla-live/boot-parameters/live-config.php

Advanced Clonezilla Usage

Advanced Clonezilla Usage.p102

Setup pxe server through ddwrt on debian system

http://www.syslinux.org/wiki/index.php/PXELINUX#Options

https://help.ubuntu.com/community/PXEInstallMultiDistro

read-only_diskless_debian7

http://www.unixmen.com/setup-local-repository-with-debian-7/

#  Setup tftp server

apt-get install tftpd-hpa

/etc/init.d/tftpd-hpa start

 

#  Testing tftp server

apt-get install tftp

uname -a >/srv/tftp/test

tftp 127.0.0.1

>get test

>quit

diff test /srv/tftp/test

 

# Install syslinux

apt-get install syslinux

cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/

# copy other interested support files
cp /usr/lib/syslinux/menu.c32 /srv/tftp
cp /usr/lib/syslinux/memdisk /srv/tftp
cp /usr/lib/syslinux/mboot.c32 /srv/tftp
cp /usr/lib/syslinux/chain.c32 /srv/tftp

 

mkdir -pv /srv/tftp/pxelinux.cfg

 

 

 

 

 

DNS (Near Las Vegas)

208.64.28.219                                                             7.68

74.222.30.2                                                                7.90

72.11.150.10                                                              7.66

72.11.150.74                                                              7.59

72.37.141.91     ns1.belairinternet.com                     7.86

74.82.42.42       ordns.he.net                                         7.73

 

4.2.2.1               Verizon                                             10
4.2.2.2               Verizon                                             10

8.3.48.20            dns1.linknetinc.com                        11.2

8.3.48.22           dns2.linknetinc.com                         11.6

12.127.17.71     dns-rs1.bgtmo.ip.att.net                   9.00

12.127.17.72    dns-rs2.bgtmo.ip.att.net                    9.00

216.146.35.35    dyn                                                   8.26
216.146.36.36    dyn                                                   8.17

209.244.0.3       Level3                                              10
209.244.0.4       Level3                                              10

208.67.222.222   OPENDNS Primary                       18.3
208.67.222.220   OPENDNS Second                        18.3

DNS (Near Chicago)

8.8.8.8                     13.6
8.8.4.4                     14.0

 

64.50.230.116           ns3.dns.tds.net          1.19
216.165.129.157       ns6.dns.tds.net          0.97
216.165.129.158       ns7.dns.tds.net          1.06
216.170.153.146       ns8.dns.tds.net          0.97

63.150.72.4               ns1.digitalteleport.com        1.07

216.52.129.1             ns1.chi.pnap.net                  1.45
216.52.129.33           ns2.chi.pnap.net                  1.35

209.244.2.66             lo-0.hsa1.Chicago1.Level3.net        1.94

174.34.129.34           174.34.129.34.rdns.ubiquityservers.com 2.34

134.48.1.32                dns1.mu.edu                               5.60
216.81.128.132        nscache3-mngt.dsm.lightedge.com      8.73

64.58.254.2               ns1.met-net.com                        14.6

DNS Server

Root DNS server

http://www.iana.org/domains/root/servers

http://public-dns.tk/

http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm

http://portforward.com/networking/dns.htm

 

Listed DNS Server:

http://portforward.com/networking/dns.htm

Google DNS
Primary: 8.8.8.8
Secondary: 8.8.4.4


Australia

QLD
144.140.70.29
144.140.71.15
144.140.70.16

Westnet (ADSL)
203.21.20.20
203.10.1.9


Canada

Shaw Cable
64.59.144.16
64.59.144.17

Telus(BC)
154.11.128.129
154.11.128.150
154.11.128.1
154.11.128.2
154.11.128.130
209.53.4.150


China

I-Cable
(Hong Kong)
210.80.60.1
210.80.60.2


Italy

Alice
212.216.112.112
212.216.172.62


Malaysia

Schoolnet (ADSL)
202.75.44.18
203.106.3.171
202.75.44.20

Tmnet Streamyx (ADSL)
202.188.0.132
202.188.0.133
202.188.0.147
202.188.0.161
202.188.0.181
202.188.0.182
202.188.1.4
202.188.1.5
202.188.1.23
202.188.1.25


Mexico

Cablemas (Cable 128kbps)
69.44.143.245
200.79.192.3


Nederland
Hetnet
10.0.0.5
10.0.0.2
10.0.0.3

Planet Internet
195.121.1.34
195.121.1.66


New Zealand

Xtra (DSL)
202.27.158.40
202.27.156.72

Paradise (DSL)
203.96.152.4
203.96.152.12


Portugal

Netvisão (Cable)
213.228.128.6
213.228.128.5

TVTel
195.22.0.204
195.22.0.205


Sweden

Tele2
130.244.127.161
130.244.127.169


United Kingdom

AOL
205.188.146.145

Blueyonder/Telewest (Cable)
193.38.113.3
194.177.157.4

BTInternet
194.73.73.172
194.73.73.173
194.72.9.44
194.72.9.38 (Cardiff, S.Wales)
194.72.9.39 (Cardiff, S.Wales)

Bulldog Broadband
Ns3.bulldogdsl.com . 83.146.21.5 (South)
Ns4.bulldogdsl.com . 83.146.21.6 (South)
Ns5.bulldogdsl.com . 212.158.248.5 (North)
Ns6.bulldogdsl.com . 212.158.248.6 (North)

Nildram (ADSL)
213.208.106.212
213.208.106.213

NTL (Cable) and Virgin.net (ADSL)
194.168.4.100
194.168.8.100

Pipex (ADSL)
62.241.162.35
62.189.34.83

Silvermead (Satellite, DSL, ISDN)
62.55.96.226
62.55.96.109 (unchecked)

Telewest (Cable)
62.31.176.39
194.117.134.19

Tiscali, Screaming.net, Worldonline, Lineone
212.74.112.66
212.74.112.67
212.74.114.129 (Cambridge)
212.74.114.193 (Cambridge)

Wanadoo UK (ADSL)
195.92.195.94
195.92.195.95

Zen Internet
Primary DNS: 212.23.8.1
Secondary DNS: 212.23.3.1


United States of America

Adelphia
67.21.13.4 Los Angeles, CA
67.21.13.2 Los Angeles, CA
24.48.217.226 Santa Monica, CA
24.48.217.227 Santa Monica, CA
68.168.1.42 Florida
68.168.1.46 Florida

Bellsouth Fast access DSL:
Georgia
205.152.37.23
205.152.37.24
205.152.37.25
205.152.144.24
205.152.144.25

Charter Comms (Cable)
68.116.46.70

Comcast (pick the nearest!)
68.87.66.196 Comcast (national) Primary DNS Server.
68.87.64.196 Comcast Secondary DNS Server.
68.57.32.5 (Virginia)
68.57.32.6 (Virginia)
216.148.227.68 (Denver, Colorado)
204.127.202.4 (Denver, Colorado)
68.42.244.5 (Taylor, Michigan)
68.42.244.6 (Taylor, Michigan)
68.62.160.5 (Huntsville, Alabama)
68.62.160.6 (Huntsville, Alabama)
68.87.96.3 (Pennsylvania)
68.87.96.4 (Pennsylvania)

Cox HSI (Cable)
68.12.16.25 (Oklahoma – Primary)
68.12.16.30 (Oklahoma – Secondary)
68.2.16.30 (Oklahoma – Tertiary)

Cox.net
68.10.16.25
68.10.16.30
68.9.16.30

Earthlink – seem to be shared by Cable and DSL users in several states. Georgia and Florida confirmed.
207.69.188.187
207.69.188.186
207.69.188.185
209.86.63.217 (Cable) – Charlotte, NC

Harrisonville Telephone Company (HTC)
216.114.114.130 (Illinois)
216.114.114.132 (Illinois)

Horry Telephone Coop
66.153.128.98 (Horry County, South Carolina)
66.153.162.98 (Horry County, South Carolina)

ORSC Public Access DNS Nameservers (Anyone can use these, no matter what ISP)
199.166.24.253
199.166.27.253
199.166.28.10
199.166.29.3
199.166.31.3
195.117.6.25
204.57.55.100

Roadrunner (Cable)
24.25.195.1 (San Diego, CA)
24.25.195.2 (San Diego, CA)
24.25.195.3 (San Diego, CA)

SBC Yahoo DSL
206.13.31.13
206.13.28.60
206.13.31.5
206.13.28.31

Speakeasy (pick any two!)
66.93.87.2 (Washington state and Oregon)
216.231.41.2 (Washington DC – probably)
216.254.95.2 (NY, Massachusetts and Pennsylvania)
64.81.45.2 (Los Angeles, California)
64.81.111.2 (Denver, Colorado)
64.81.127.2 (Dallas, Texas)
64.81.79.2 (Sacramento, California)
64.81.159.2 (Baltimore and Washington DC)
66.92.64.2 (Boston, Massachusetts)
66.92.224.2 (Philadelphia)
66.92.159.2 (Washington DC)
216.27.175.2 (Atlanta, Georgia. Serves Florida too)

Sprintlink (nationwide)
204.117.214.10
199.2.252.10
204.97.212.10

TimeWarner
24.93.1.119 (Rochester, NY)

Unicom
216.104.64.5 (Grants Pass, OR)
216.104.72.5 (Portland, OR)

FrontierNet / Citlink / New North DNS addresses:
66.133.170.2 (Rochester, NY)
170.215.255.114 (Rochester, NY)
216.67.192.3 (Arizona)
207.173.225.3 (Arizona)
207.173.225.3 (California)
216.67.192.3 (California)
170.215.255.114 (New York (areas other than Rochester))
66.133.170.2 (New York (areas other than Rochester))
170.215.184.3 (West Virginia)
170.215.126.3 (West Virginia)
170.215.126.3 (Tennessee, Georgia)
170.215.184.3 (Tennessee, Georgia)
67.50.135.146 (Illinois)
66.133.191.35 (Illinois)
66.133.191.35 (Wisconsin, Minnesota, Iowa, North Dakota and Nebraska)
170.215.255.114 (Wisconsin, Minnesota, Iowa, North Dakota and Nebraska)

Suddenlink DNS Numbers
209.55.0.110
209.55.1.220
Verizon (Level3) – these are not restricted to Verizon customers
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
4.2.2.5
4.2.2.6

Wave Broadband
24.113.32.29
24.113.32.30

 

http://theos.in/windows-xp/free-fast-public-dns-server-list/

Free Public DNS Server

=> Service provider: Google
Google public dns server IP address:

  • 8.8.8.8
  • 8.8.4.4

=> Service provider:OpenDNS
OpenDNS free dns server list / IP address:

  • 208.67.222.222
  • 208.67.220.220

=> Service provider:Opennicproject (visit this url to get nearest DNS server for your country)

  • 151.236.6.156
  • 118.88.20.195

=> Service provider:DynDNS

  • 216.146.35.35
  • 216.146.36.36

=> Service provider:Dnsadvantage
Dnsadvantage free dns server list:

  • 156.154.70.1
  • 156.154.71.1

=> Service provider:SafeDNS

  • 195.46.39.39
  • 195.46.39.40

=> Service provider:Comodo Secure DNS

  • 8.26.56.26
  • 8.20.247.20

=> Service provider:Norton
Norton free dns server list / IP address:

  • 198.153.192.1
  • 198.153.194.1

=> Service provider: GTEI DNS (now Verizon)
Public Name server IP address:

  • 4.2.2.1
  • 4.2.2.2
  • 4.2.2.3
  • 4.2.2.4
  • 4.2.2.5
  • 4.2.2.6

 

http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm

Provider Primary DNS Server Secondary DNS Server
Level31 209.244.0.3 209.244.0.4
Google2 8.8.8.8 8.8.4.4
Comodo Secure DNS 8.26.56.26 8.20.247.20
OpenDNS Home3 208.67.222.222 208.67.220.220
DNS Advantage 156.154.70.1 156.154.71.1
Norton ConnectSafe4 199.85.126.10 199.85.127.10
GreenTeamDNS5 81.218.119.11 209.88.198.133
SafeDNS6 195.46.39.39 195.46.39.40
OpenNIC7 216.87.84.211 23.90.4.6
Public-Root8 199.5.157.131 208.71.35.137
SmartViper 208.76.50.50 208.76.51.51
Dyn 216.146.35.35 216.146.36.36
FreeDNS9 37.235.1.174 37.235.1.177
censurfridns.dk10 89.233.43.71 89.104.194.142
DNS.WATCH11 84.200.69.80 84.200.70.40
Hurricane Electric12 74.82.42.42
puntCAT13 109.69.8.51

[1] The free DNS servers listed above as Level3 will automatically route to the nearest DNS server operated by Level3 Communications, the company that provides most of the ISPs in the US their access to the Internet backbone.

[2] Google also offers IPv6 public DNS servers: 2001:4860:4860::8888 and 2001:4860:4860::8844.

[3] OpenDNS also offers DNS servers that block adult content, called OpenDNS FamilyShield. Those DNS servers are 208.67.222.123 and 208.67.220.123. A premium DNS offering is also available, called OpenDNS Home VIP.

[4] The Norton ConnectSafe free DNS servers listed above block sites hosting malware, phishing schemes, and scams, and is called Policy 1. Use Policy 2 (199.85.126.20 and 199.85.127.20) to block those sites plus those with pornographic content. Use Policy 3 (199.85.126.30 and 199.85.127.30) to block all previously mentioned site categories plus those Norton deems “non-family friendly.” Be sure to check out the list of things blocked in Policy 3 – there are several controversial topics in there that you may find perfectly acceptable.

[5] GreenTeamDNS “blocks 18 categories which include malware, botnets, dangerous websites, adult related content, aggressive/violent sites as well as advertisements and drug-related websites” according to their FAQ page. Premium accounts have more control.

[6] Register here with SafeDNS for content filtering options in several areas.

[7] The DNS servers listed here for OpenNIC are just two of many in the US and across the globe. Instead of using the OpenNIC DNS servers listed above, see their complete list of public DNS servers here and use two that are close to you or, better yet, let them tell you that automatically here. OpenNIC also offers some IPv6 public DNS servers.

[8] These Public-Root DNS servers are the only two currently operating in the United States but if you’re located ouside the US, see their complete list here and choose the best servers based on your location.

[9] FreeDNS says that they “never log DNS queries.” Their free DNS servers are located in Austria.

[10] The censurfridns.dk DNS servers are uncensored, operated by a privately funded individual, and are physically located in Denmark. You can read more about them here. IPv6 DNS servers are also available at 2002:d596:2a92:1:71:53:: and 2002:5968:c28e::53.

[11] DNS.WATCH also has IPv6 DNS servers at 2001:1608:10:25::1c04:b12f and 2001:1608:10:25::9249:d69b. In an uncommon but much appreciated move, DNS.WATCH publishes live statistics for both of their free DNS servers. Both servers are located in Germany.

[12] Hurricane Electric also has an IPv6 public DNS server available: 2001:470:20::2.

[13] puntCAT is physically located near Barcelona, Spain. The IPv6 version of their free DNS server is 2a00:1508:0:4::9.

Note: Primary DNS servers are sometimes called preferred DNS servers and secondary DNS servers are sometimes called alternate DNS servers. Primary and secondary DNS servers can be “mixed and matched” to provide another layer of redundancy.

PAC/WPAD

http://findproxyforurl.com/wpad-introduction/

https://code.google.com/p/pacparser/

Note:

IETF draft Spec expired at 1999

Socks not supported officially

 

Testing:

pactester -p pad.dat  -f url.list

 

cat pad.dat:

function FindProxyForURL(url, host)  
{
        if (isInNet(host, “172.16.0.0”, “255.240.0.0”)||
            isInNet(host, “192.168.0.0”, “255.255.0.0”)||
            isInNet(host, “10.0.0.0”,”255.0.0.0″)||
            isInNet(host, “127.0.0.0”,”255.0.0.0″)||
            dnsDomainIs(host, “clouddevice.zhenglei.net”)||
            dnsDomainIs(host, “blogdevice.zhenglei.net”)||
            dnsDomainIs(host, “pydiodevice.zhenglei.net”)||
            dnsDomainIs(host, “cloudhost.zhenglei.net”)||
            dnsDomainIs(host, “blogdhost.zhenglei.net”)||
            dnsDomainIs(host, “pydiohost.zhenglei.net”)
           )  
           { return “DIRECT”; }  
         
         if ( url.substring(0, 4)==”ftp:” )
           return “SOCKET 127.0.0.1: 4567”   
 
         if (isPlainHostName(host) ||
            shExpMatch(host, “*.local”)||
            dnsDomainIs(host, “.cn”)||
            dnsDomainIs(host, “www.taobao.com”)||
            dnsDomainIs(host, “www.jd.com”)||
            dnsDomainIs(host, “www.51buy.com”)||
            dnsDomainIs(host, “www.yixun.com”)||
            dnsDomainIs(host, “www.tmall.com”)||
            dnsDomainIs(host, “.gtime.com”)
           )
        return “PROXY 172.24.61.252: 8080”;
 
        return “SOCKET 127.0.0.1: 4567; PROXY 172.24.61.252: 8080”
}

 

 cat  url.list

http://clouddevice.zhenglei.net
http://blogdevice.zhenglei.net
http://pydiodevice.zhenglei.net
http://cloudhost.zhenglei.net
http://bloghost.zhenglei.net
http://pydiohost.zhenglei.net
http://blog.zhenglei.net
http://www.sina.com.cn
http://static.gtimg.com
http://www.51buy.com
http://www.jd.com
http://www.taobao.com
http://www.tmall.com