In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In my work, I need to modify two files:
File one: / etc/vmware/networking
VERSION=1,0answer VNET_1_DHCP yesanswer VNET_1_DHCP_CFG_HASH 50CE8453B1072EA401BFFA704E6C01F7AE0BA67Canswer VNET_1_HOSTONLY_NETMASK 255.255.255.0answer VNET_1_HOSTONLY_SUBNET 172.16.77.0answer VNET_1_VIRTUAL_ADAPTER yesanswer VNET_8_DHCP yesanswer VNET_8_DHCP_CFG_HASH 1DA1A936DCB3AA3313CF293A9C96D25B76AB48A2answer VNET_8_HOSTONLY_NETMASK 255.255.255.0answer VNET_8_HOSTONLY_SUBNET 192.168.43.0answer VNET_8_NAT yesanswer VNET_8_VIRTUAL_ADAPTER yes
File 2: / etc/vmware/vmnet8/dhcpd/dhcpd.conf
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.## This file was automatically generated by the VMware configuration program.# See Instructions below if you want to modify it.## We set domain-name-servers to make some DHCP clients happy# (dhclient as configured in SuSE, TurboLinux, etc.). # We also supply a domain name to make pump (Red Hat 6.x) happy.# VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" # Modification Instructions: This section of the configuration file contains# information generated by the configuration program. Do not modify this# section.# You are free to modify everything else. Also, this section must start# on a new line# This file will get backed up with a different name in the same directory# if this section is edited and you try to configure DHCP again.# Written at: 03 15:49:55allow unknown-clients;default-lease-time 22 shock 2013 15:49:55allow unknown-clients;default-lease-time 1800; # default is 30 minutesmax-lease-time 7200; # default is 2 hourssubnet 192.168.43.0 netmask 255.255.255.0 {range 192.168.43.128 192.168.43.254 option broadcast-address 192.168.43.255 Option domain-name-servers 192.168.43.2 option domain-name localdomain;default-lease-time 1800; # default is 30 minutesmax-lease-time 7200; # default is 2 hoursoption netbios-name-servers 192.168.43.2 option routers 192.168.43.2;} host vmnet8 {hardware ethernet 0050 minutesmax-lease-time 56 domain-name-servers 00010 domain-name-servers 08 fixedTee address 192.168.43.1 option domain-name-servers 0.0.0.0 option domain-name "; option routers 0.0.0.0 } # VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #
Demand:
Change "192.168.43" in both files to "202.16.22", but sometimes "192.168.43" will show other IP values, and the target string "202.16.22" may be set separately as the environment changes.
Based on this requirement, I wrote the following test script:
For file one:
The #! / bin/bash# $vmnat_subnet_old variable represents the original subnet configuration of vmnat8. Note that only the first three segments of vmnat_subnet_old= `grep "VNET_8_HOSTONLY_SUBNET" / etc/vmware/networking are truncated. | cut-d''- f 3` # $vmnat_subnet_new indicates the target configuration of the vmnat8 subnet. Note that only the first three paragraphs vmnat_subnet_new='192.168.40'cp / etc/vmware/networking / etc/vmware/networking_bak0sed-I'/ VNET_8_HOSTONLY_SUBNET/s/' "$vmnat_subnet_old" /'"$vmnat_subnet_new" /'/ etc/vmware/networkinggrep "$vmnat_subnet_new" / etc/vmware/networkingcp / etc/vmware/networking_bak0 / etc/vmware/networking are intercepted.
For file two:
The #! / bin/bash# $vmnat_subnet_new variable represents the target configuration of the vmnat8 subnet. Note that only the first three segments of vmnat_subnet_new='192.168.40'# $vmnat_subnet_old variable are truncated to represent the original subnet configuration of vmnat8. Note that only the first three segments of vmnat_subnet_old= `grep "VNET_8_HOSTONLY_SUBNET" / etc/vmware/networking are truncated | sed's vmnat_subnet_new... "vmnat_subnet_new" / g' / "$vmnat_subnet_new" / g'/ / Etc/vmware/vmnet8/dhcpd/dhcpd.confgrep "$vmnat_subnet_new" / etc/vmware/vmnet8/dhcpd/dhcpd.confcp / etc/vmware/vmnet8/dhcpd/dhcpd.conf_bak0 / etc/vmware/vmnet8/dhcpd/dhcpd.conf
Advantages:
You don't have to know in advance what the character to replace is (in this case: 192.168.43), just know what you want to replace (in this case: 202.16.22).
Oh, a screenshot of my work desktop.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.