Single Nic Dual ip connection to nfs server does not seem to work

Source: Internet
Author: User
Tags block ip address
The dual-ip address of a single network adapter cannot connect to the nfs server. For more information, see Linux Enterprise Application-Linux server application. Environment: as A gateway, the firewall has two CIDR blocks: 192.168.0.0/24, 192.168.0.1, 192.168.0.2, and 192.168.2.0/24, the gateway address on the firewall is 192.168.2.1, with A client address 192.168.2.5 and only one Nic. You need to add an ip address to connect to the nfs service on the network segment server. Both the server and client operating systems are ubuntu 7.04.
Nfs server is better off. You can install nfs-kernel-server and related packages on apt. The default service port is 2049, And the configuration file/etc/exports is as follows:

/Home/fwolf 192.168.0.5 (rw, sync, subtree_check)/home/share * (ro, subtree_check) do not install nfs-user-server, which is nfs v2, not nfs v3, files larger than 4 GB are not supported. Restricted/home/fwolf can be accessed only by host 192.168.0.5. The client can collect mountnfs servers:

Sudo mount-t nfs svrname:/home/fwolf local_mount_point can also be written to fstab:

Svrname:/home/fwolf local_mount_point nfs defaults 0 0, but it cannot be changed. This may be the root cause of failure. The client address on the firewall is another CIDR block address configured on the firewall. Therefore, you need to add a cidr Block ip address to the client, direct access without using the firewall.

Aliases are used to add Dual ip addresses for a single Nic. Therefore, the/etc/network/interfaces file is as follows:

Auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.2.5
Netmask 255.255.255.0

Auto eth0: 0
Iface eth0: 0 inet static
Address 192.168.0.5
Netmask 255.255.255.0
Do not set gateway for both addresses, and then add static route settings in rc. local:

Route add-net 192.168.0.0/24 gw
192.168.0.1 dev eth0: 0 route add default gw 192.168.2.1 dev eth0 then restart the network and run rc. local:

Sudo/etc/init. d/networking restart; sudo/etc/rc. local now, check the route table:

$ RouteKernel IP routeing tableDestination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 192.168.0.1
255.255.255.0 UG 0 0 0 eth0192.168.0.0 *
255.255.255.0 U 0 0 0 eth0192.168.2.0 *
255.255.255.0 U 0 0 0 eth0default 192.168.2.1
0.0.0.0 UG 0 0 0 eth0 as expected, If you access the network segment from the client, the first line of the corresponding route table should be used. The IP address displayed on the server is 192.168.0.5, if you access other network segments, use the default gateway 192.168.2.1, corresponding to the local IP address 192.168.2.5. However, my practice proves that this is not the case. Even when rc. local is added with any or all of the following statements:

Route add-net 192.168.0.0/24 dev eth0: 0 route add-host
192.168.0.2 dev eth0: 0 route add-host 192.168.0.2 gw
192.168.0.1 dev eth0: 0 can be successful occasionally, but it feels unstable, so it is a failure. There are three possibilities:

The way the firewall works cannot be changed.
The route command is not added correctly. I think it should be correct.
This path does not work at all. A single network card cannot have multiple ip addresses and can only use multiple network cards. I think this is not possible.
For the time being, only nfs address restrictions can be relaxed, or sshfs with slow speed (especially in the LAN) can be used for implementation.

[ This post was last edited by ailxudrye]
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.