2018年11月11日 星期日

How to setup DHCPv6 server under Centos

How to setup DHCPv6 server under Centos

1.yum install dhcp
2.vim /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.3.10
GATEWAY=192.168.3.1
BOOTPROTO=static
IPV6INIT=yes
IPV6ADDR=2018:4:10:ffff::2/64
IPV6_AUTOCONF=no
IPV6_DEFAULTGW=2018:4:10:ffff::1


3.systemctl restart network
systemctl stop firewalld.service

4.1.Edit dhcpd6.conf
vim /etc/dhcp/dhcpd6.conf

# DHCPv6 Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd6.conf.example
# see dhcpd.conf(5) man page
default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;
option dhcp6.info-refresh-time 21600;
dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";
subnet6 2018:4:10:ffff::/64 {
range6 2018:4:10:ffff::10 2018:4:10:ffff::1000;
option dhcp6.bootfile-url
"tftp://[2018:4:10:ffff::2]/bootx64.efi ;
}

5. service network restart
/usr/sbin/dhcpd -6 -d -cf /etc/dhcp/dhcpd6.conf ens33

Install Intel® Omni-Path Host Fabric Interface (HFI)

Install Intel® Omni-Path Host Fabric Interface (HFI)
https://www.intel.in/content/www/in/en/support/articles/000026809/network-and-i-o/fabric-products.html


Red Hat Enterprise Linux 7 Update 5:
o IntelOPA-IFS.RHEL75-x86_64.10.8.0.0.204.tgz - Drivers and Utilities
o IntelOPA-FirmwareTools-RHEL75-x86_64.10.8.0.0.13.tgz - Firmware Tools
o IntelOPA-TMM-RHEL75-x86_64.10.8.0.0.214.tgz - TMM Firmware
o IntelOPA-UEFI-RHEL75-x86_64.1.8.1.0.0.tgz - UEFI Driver
o IntelOPA-FMGUI.linux-10.8.0.0.215.tgz - Fabric Manager GUI

2.2.3 Install Software in Unattended Mode
It is strongly suggested to install the necessary Omni-Path drivers in
unattended mode. This will automatically ensure the correct software
is fully installed. If manual/attended mode is desired, please skip to section 2.2.4 below.

a. Extract the content of the IFS tgz file to a local directory.
b. Execute the INSTALL script with the -a parameter and follow the on-screen prompts.
./INSTALL -a

c. After installation is fully complete, reboot the server and skip to step 2.3 below.

2.2.4 Install Software in Attended Mode
If manual/attended installation mode is chosen, the default selections
include libraries and utilities for connecting and managing an OPA fabric.
a. Ensure the following are installed for the Omni-Path driver and firmware to load correctly:
- Pre-Boot Components
- OPA Stack
- Intel HFI Components
- OPA Tools
- OFA OPA Development
- OFA IP over OB

b. Press 'P' once all selections have been made.
c. Press Enter for each option and wait for installation to finish.
d. On completion, press 'X' to properly exit the script.
e. After installation is fully complete, reboot the server.

2.3 Firmware Update Instructions
2.3.1 Install the firmware tools, TMM, and UEFI image. As of 10.8, these are distributed separately from IFS.
Get from IntelOPA-FirmwareTools-RHEL75-x86_64.10.8.0.0.13.tgz
#rpm -Uvh hfi1-firmware-tools-10.8.0.0-13.x86_64.rpm
Get from IntelOPA-TMM-RHEL75-x86_64.10.8.0.0.214.tgz
#rpm -Uvh hfi1-tmm-10.8.0.0-214.noarch.rpm
Get from IntelOPA-UEFI-RHEL75-x86_64.1.8.1.0.0.tgz
#rpm -Uvh hfi1-uefi-1.8.1.0-0.x86_64.rpm

2.3.2 Flash Omni-Path Adapter Firmware
a. Navigate to the directory /usr/share/opa/bios_images/:
cd /usr/share/opa/bios_images/

b. Use the hfi1_eprom utility to flash the adapter firmware:
hfi1_eprom -S -w -o HfiPcieGen3Loader_xxxx.rom -b HfiPcieGen3_xxxx.efi
Note: If multiple adapters are installed, specify each adapter to flash:
hfi1_eprom -S -w -o HfiPcieGen3Loader_xxxx.rom -b HfiPcieGen3_xxxx.efi -d /sys/bus/pci/devices/xxxx:xx:xx.x/resource0

c. Verify the firmware was flashed correctly:
hfi1_eprom -V -o
hfi1_eprom -V -b
hfi1_eprom -V -c

2.3.3 Flash Thermal Management Microchip (TMM) Firmware
a. Navigate to the directory /lib/firmware/updates/:
cd /lib/firmware/updates/
b. Use the opatmmtool utility to flash the adapter firmware:
opatmmtool -f hfi1_smbus.fw fileversion
opatmmtool -f hfi1_smbus.fw update
c. Verify the TMM was flashed correctly:
opahfirev
2.4 Insallation Troubleshooting
2.4.1 Verify Firmware Image Files
The firmware image files should be located in the following locations:
OPA UEFI Driver: /usr/share/opa/bios_images/HfiPcieGen3*.efi
OPA UEFI Driver Loader: /usr/share/opa/bios_images/HfiPcieGen3Loader*.rom
OPA Configuration: /lib/firmware/updates/hfi1_platform.dat
OPA TMM Firmware: /lib/firmware/updates/hfi1_smbus.fw

2.4.2 Verify Application Software
The commands `opainfo` and `opahfirev` should report adapter information and firmware/driver version details if all software is properly installed.
2.4.3 Installation Logs
If any errors are encountered during installation of the drivers or firmware, refer to the log file (/var/log/opa.log) for additional information.

How to setup PXE for Intel OPA (Onmi-Path)


How to setup PXE for Intel OPA (Onmi-Path)

a. Install Intel® Omni-Path Fabric Suite Fabric Manager using the command:
yum install opa-fm
b. Start up Fabric Manager using the following command:
service opafm start

2. The HFI driver (hfi1) and IP over InfiniBand* modules must be running. Use the commands:
modprobe hfi1
modprobe hfi1 modprobe ib_ipoib

5.5.1.1.1 Configure Network Interface
1. Add ib0 network interface configuration file: /etc/sysconfig/network- scripts/ifcfg-ib0
2. Add the following content related to DHCP configuration to the configuration file:

DEVICE=ib0
TYPE=Infiniband
BOOTPROTO=static
IPADDR=192.168.100.1
NETMASK=255.255.255.0
NETWORK=192.168.100.0
BROADCAST=192.168.100.255
ONBOOT=yes
USERCTL=no

3. Run the following command, where ib0 is the name of the network interface configured in step 2:
ifdown ib0
ifup ib0

5.5.1.1.4 Install a TFTP Server
Prerequisite: XINETD may have been installed with OS. If not, use the following command:

yum install xinetd

To install a TFTP server, perform the following steps:
1. Install TFTP package using the command:
yum install tftp-server

2. Add or modify TFTP configuration file. An example is shown below:
etc/ xinetd.d/tftp
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot #-s 表示用/tftpboot作为tftp目录的根目录
disable = no #默认是yes,改为no per_source = 11 cps = 100 2 flags = IPv4 }
Note: The disable field defaults to yes and should be changed to no before starting the XINETD server.

3. Start XINETD server using the command:
service xinetd start

4. Enable XINETD service to be run always with OS start:
systemctl enable xinetd.service


5.Configure the FTP Server
#yum install vsftpd
#mkdir /var/ftp/pub/rhel75
copy all files from rhel7.5 iso to /var/ftp/pub/rhel75

5.5.1.1.7 Configure the Boot Loader
To configure a PXE server to use the Grub2 boot loader, perform the following steps.
Note: For configuration details of other boot loaders, please refer to your OS vendor documentation.

1. Copy the shim.efi file from the shim package and the grubx64.efi file from the grub2-efi package in the ISO image file. Enter the following commands as root: (In Packages)
2. Extract the packages.
# rpm2cpio shim-version-architecture.rpm | cpio -dimv
# rpm2cpio grub2-efi-version-architecture.rpm | cpio -dimv

3. Copy the EFI boot images from your boot directory.
# cp publicly_available_directory/boot/efi/EFI/redhat/shim.efi /tftpboot/uefi
# cp publicly_available_directory/boot/efi/EFI/redhat/grubx64.efi /tftpboot/uefi

5.5.2.2 Install RHEL* 7.4 over Intel® OP HFI
To edit the initrd.img, perform the following steps:
1. Log in as root.
2. Decompress the .iso archive with RHEL* 7.4 distribution. The initrd.img is located in the /images/pxeboot folder.
The initrd.img is located in the /images/pxeboot folder.
3. Create /home/images/initrd folder.
mkdir -p /home/images/initrd
4. Copy initrd.img to home/images/initrd.
cp <.iso decompressed archive path>/images/pxeboot/initrd.img /home/images/ initrd
5. Change directories to /home/images/initrd.
cd /home/images/initrd

6. Check archive type. For example:
file initrd.img
initrd.img: XZ compressed data

7. Extract initrd.img according to archive type:
• For XZ archive
xzcat ./initrd.img | cpio -d -i -m
• For GZ archive
gunzip < initrd.img | cpio -i --make-directories

8. Move initrd.img out of the folder.
mv ./initrd.img ../initrd.img

Note: From this point on in the instructions, all commands assume that the present working directory (pwd) is /home/images/initrd and all commands are relative to this path.
9. Copy firmware files.
cp --recursive /lib/firmware/updates/ usr/lib/firmware/updates/
The list of required firmware files are:

/lib/firmware/updates/hfi1_dc8051_d.fw
/lib/firmware/updates/hfi1_dc8051.fw
/lib/firmware/updates/hfi1_fabric_d.fw
/lib/firmware/updates/hfi1_fabric.fw
/lib/firmware/updates/hfi1_pcie_d.fw
/lib/firmware/updates/hfi1_pcie.fw
/lib/firmware/updates/hfi1_sbus_d.fw
/lib/firmware/updates/hfi1_smbus.fw
/lib/firmware/updates/hfi_dc8051.bin

10. Add ib_ipoib.conf file.
mkdir etc/modules-load.d/
touch etc/modules-load.d/ib_ipoib.conf
echo "# Load ib_ipoib.ko at boot" >> etc/modules-load.d/ib_ipoib.conf
echo "ib_ipoib" >> etc/modules-load.d/ib_ipoib.conf

11. Generate initrd-new.img file and give permissions.
cd /home/images/initrd
find . -print |cpio -o -H newc | xz --format=lzma > ../initrd-new.img
chmod 777 ../initrd-new.img

Note: Remember to use appropriate Linux kernel file (vmlinuz) along with initrd.img.

12. Update grub.cfg to include the line insmod=ib_ipoib netdevice=ib0 netsetup=dhcp.
This forces an automatic ib_ipoib module start, uses ib0 as a default network device, and configures IP address via DHCP
#vi /tftpboot/grub.cfg
set default="0"
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}
load_video
set gfxpayload=keep
insmod net
insmod efinet
insmod tftp
insmod gzio
insmod part_gpt
insmod ext2
set timeout=60

### END /etc/grub.d/00_header ###
search --no-floppy --set=root -l 'CentOS 7 x86_64'
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Install RHEL 7.5 ' --class fedora --class gnu-linux --class gnu --class os {
linuxefi (tftp)/vmlinuz insmod=ib_ipoib netdevice=ib0 netsetup=dhcp inst.repo=ftp://192.168.100.1/pub/rhel
initrdefi (tftp)/initrd-new.img
}

If you PXE fail check PXE server services are on
#service vsftpd status
#service dhcpd status
#service tftp status
#seriver xinetd

How to use Centos repo in RHEL(YUM)


How to use Centos repo in RHEL(YUM)

# vi /etc/yum.repos.d/CentOS.repo
Below is example for Centos 7

[CentOS7 base]
name=CentOS-7-Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

[CentOS7 updates]
name=CentOS-7-Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

[CentOS7plus]
name=CentOS-7-Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

[centos]
name=CentOS $releasever - $basearch
baseurl=http://ftp.heanet.ie/pub/centos/7/os/$basearch/
enabled=1
gpgcheck=0

How to create bootable live USB form linux dd comand

How to create bootable live USB form linux dd comand


# dd if=ubuntu-16.10-desktop-amd64.iso of=/dev/sdX bs=1M

sdX is your USB device

How to check CPU&memory loading under ubuntu

How to check CPU&memory loading under ubuntu Memory #free -m CPU #top Or install sw # sudo apt-get install htop #htop