性能测试时,为了排除网络因素的干扰,很可能需要设置专线进行测试,下面是记录的专线网络的设置方法。
服务器设置:
说明:
1. 先要制作一根两头的水晶头是反线的网线;
2. 找到服务器的一个空闲的网口,如eth2;
3. 设置eth2网口对应的网卡配置(注,eth2网口对应的是ifcfg-eth1配置文件);
4. 必须设置一个独立的网段,如内网是111网段,则必须设置一个另外的网段才行,比如222网段;
5. 客户端也必须设置与服务器端一样的网段的IP地址。
[root@zjxl-5 ~]# cd /etc/sysconfig/network-scripts/
[root@zjxl-5 network-scripts]# ls
ifcfg-eth0 ifdown ifdown-ipv6 ifdown-sit ifup-bnep ifup-ipx ifup-ppp ifup-wireless
ifcfg-eth1 ifdown-bnep ifdown-isdn ifdown-sl ifup-eth ifup-isdn ifup-routes init.ipv6-global
ifcfg-eth2 ifdown-eth ifdown-post ifdown-tunnel ifup-ippp ifup-plip ifup-sit net.hotplug
ifcfg-eth3 ifdown-ippp ifdown-ppp ifup ifup-ipsec ifup-plusb ifup-sl network-functions
ifcfg-lo ifdown-ipsec ifdown-routes ifup-aliases ifup-ipv6 ifup-post ifup-tunnel network-functions-ipv6
[root@zjxl-5 network-scripts]# cp ifcfg-eth1 ifcfg-eth1.bak //备份原文件
[root@zjxl-5 network-scripts]# cp ifcfg-eth0 ifcfg-eth1 //拷贝源文件的内容,方便修改
cp:是否覆盖“ifcfg-eth1”? y
[root@zjxl-5 network-scripts]# vi ifcfg-eth1 //编辑eth1网卡信息
[root@zjxl-5 network-scripts]# more ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=none
IPADDR=192.168.222.52 //设置一个独立的网段
NETMASK=255.255.255.0 //子网掩码
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@zjxl-5 network-scripts]#
[root@zjxl-5 network-scripts]# ifdown eth1 //重启eth1网卡
[root@zjxl-5 network-scripts]# ifup eth1
[root@zjxl-5 network-scripts]# ifconfig //查看设置的网卡及IP信息
eth0 Link encap:Ethernet HWaddr 2C:76:8A:AD:10:E4
inet addr:192.168.111.51 Bcast:192.168.111.255 Mask:255.255.255.0
inet6 addr: fe80::2e76:8aff:fead:10e4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:283007063 errors:0 dropped:0 overruns:0 frame:0
TX packets:196217196 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:190879168113 (177.7 GiB) TX bytes:55008466270 (51.2 GiB)
Interrupt:16 Memory:f4000000-f4012800
eth1 Link encap:Ethernet HWaddr 2C:76:8A:AD:10:E6
inet addr:192.168.222.52 Bcast:192.168.222.255 Mask:255.255.255.0
inet6 addr: fe80::2e76:8aff:fead:10e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4838333 errors:0 dropped:0 overruns:0 frame:0
TX packets:3870677 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:654641560 (624.3 MiB) TX bytes:462290899 (440.8 MiB)
Interrupt:17 Memory:f2000000-f2012800
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:106654092 errors:0 dropped:0 overruns:0 frame:0
TX packets:106654092 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:48415942506 (45.0 GiB) TX bytes:48415942506 (45.0 GiB)
[root@zjxl-5 network-scripts]#
客户端设置: