通过集群联网

2016/11/1 posted in  集群管理

这个是前阵子弄得了,实验室老师抱怨连Wi-Fi网速实在太慢了,想走集群的带宽上网。
配置好后,连网线上网能达到1MB/s,喜大普奔: )

搭建DHCP服务器

DHCP为用户动态分配IP

查看是否已安装dhcp

which dhcpd

如果没有安装,安装dhcp

yum install dhcp

配置dhcp

vim /etc/dhcp/dhcpd.conf

当前服务器上的dhcp配置文件,可供参考

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway
    option routers          192.168.0.98;
    option subnet-mask      255.255.255.0;

    option nis-domain       "TS10K";
#   option domain-name      "domain.org";
    option domain-name-servers  8.8.8.8;

    option time-offset      -18000;
# Eastern Standard Time
#   option ntp-servers      192.168.0.1;
#   option netbios-name-servers 192.168.0.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#   option netbios-node-type 2;

    range dynamic-bootp 192.168.0.128 192.168.0.254;
    default-lease-time 21600;
    max-lease-time 43200;

####### network installation configuration
    allow booting;
    allow bootp;
    class "pxeclients" {
    match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
            next-server 192.168.0.100;
            filename "pxelinux.0";
    }
####### network installation configuration



    # we want the nameserver to appear at a fixed address
}

服务器转发流量

服务器将互联网的数据包转发到局域网,将局域网的包发出去

开启ipv4数据包转发

在 /etc/sysctl.conf 里 取消注释下面这行
net.ipv4.ip_forward=1

使新配置生效

sysctl -p

允许局域网节点访问外网,参考这个

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 

然后还需要配置防火墙规则,这个记不得了....

出于安全性考虑,就不贴上现在的ip table配置了

参考

Configuring a DHCP Server
FORWARD and NAT Rules
防火墙