Thứ Bảy, 28 tháng 7, 2012

Linux Networking Setup

Required Information

To enable networking, you must configure your network interface card or cards with an IP address and netmask. The kernel must have support for your cards compiled in, either as modular support or direct support. If you don't have kernel support read the sections about the kernel and how to compile it. To set your cards up, do the following. In my example my network is 192.168.1.0, IP=192.168.1.100, broadcast=192.168.1.255, netmask=255.255.255.0, gateway-192.168.1.1, nameserver=192.168.1.10.
  1. Determine your machines IP address from your network administrator
  2. Your network mask. This determines which portion of the IP address specifies the subnetwork number and which portion specifies the host.
    Class C (most networks) 255.255.255.0
    Class B 255.255.0.0
  3. Your network address which is your IP address bit wise anded with the network mask.
    Ex: IP: 192.168.1.100
    Mask: 255.255.255.0
    Net Addr:: 192.168.1.0
  4. Your broadcast address. Used to broadcast packets to every machine on your subnet.
    Ex: IP: 192.168.1.100
    Mask: 255.255.255.0
    Net Addr: 192.168.1.255
  5. Your gateway address. The address of the machine that is your gateway to the outside world.
    In many cases: Ex: IP: 192.168.1.100 Gateway: 192.168.1.1
  6. Your nameserver address. Translates host names into IP addresses. 192.168.1.10

Configuration tools

There are many network configuration tools today. They are:
netconf
A GUI interactive interface available on Redhat 6.1
linuxconf
A GUI interactive interface available on Redhat 6.1 which includes netconf configuration.
netconfig
A GUI step by step interface
ifconfig
A text based program to configure the network interface. Type "man ifconfig" for info.
These programs will modify values in the following files:
  • /etc/sysconfig/network - Defines your network and some of its characteristics.
  • /etc/HOSTNAME - Shows the host name of this host. IF your name is "myhost" then that is exactly the text this file will contain.
  • /etc/resolv.conf - Specifies the domain to be searched for host names to connect to, the nameserver address, and the search order for the nameservers.
  • /etc/host.conf - Specifies the order nameservice looks to resolve names.
  • /etc/hosts - Shows addresses and names of local hosts.
  • /etc/networks - Provides a database of network names with network addresses similar to the /etc/hosts file. This file is not required for operation.
  • /etc/sysconfig/network-scripts/ifcfg-eth* - There is a file for each network interface. This file contains the IP address of the interface and many other setup variables.

Analysis Tools

  • netstat - Displays information about the systems network connections, including port connections, routing tables, and more. The command "netstar -r" will display the routing table.
  • traceroute - This command can be used to determine the network route from your computer to some other computer on your network or the internet. To use it you can type "route IPaddress" of the computer you want to see the route to.
  • nslookup - Used to query DNS servers for information about hosts.
  • arp - This program lets the user read or modify their arp cache.
  • tcpdump - This program allows the user to see TCP traffic on their network.
  • dig(1) - Send domain name query packets to name servers for debugging or testing.

Manual Configuration

You can use one of the above tools or configure the network the old fashioned way as follows:
  1. First to use networking on any permanent basis you should setup the file /etc/sysconfig/network similar to the example shown below.
  2. Assign an ip address with "ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up".
  3. Tell your machine that a hub is ready for information with the command "route add -net 192.168.0.0 netmask 255.255.255.0 eth0"
  4. To contact hosts outside your network if a machine with IP address 192.168.1.1 is the gateway use the command "route add default gw 192.168.1.1 eth0"
  5. If using a dialup connection use the command "route add default ppp0" The word default says if the packet is not for a machine on your local network, send it to the default device.
These settings are not permanent, but go away the next time you boot. They are normally set up in the directory /etc/sysconfig/network-scripts. Add the network interface to the file /etc/sysconfig/network-scripts/ifcfg-eth*. For example the file ifcfg-eth0 if for the first ethernet interface, ifcfg-eth1 for the second, ifcfg-lo is for the local interface. An example file from my system is:
DEVICE="eth0"
IPADDR="192.168.1.100"
NETMASK="255.255.0.0"
ONBOOT="yes"
BOOTPROTO="none"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"
Unless you know what you're doing it is best to use a network configuration tool. I cannot guarantee the accurateness of how to set these files up on your system.

Configuring an interface for multiple IP addresses

If you want to configure your network card to act as more than one IP address, issue the following command:
ifconfig dummy 192.168.1.102 netmask 255.255.255.0
This uses the dummy system interface capability supported in the kernel to setup another virtual interface which operates at IP address 192.168.1.102. Substitute the IP address that you want your virtual interface to be with an appropriate netmask for your network. To disable this, issue the following command.
ifconfig dummy down
Another way to use multiple IP addresses on one ethernet card is to set up a new file in your /etc/sysconfig/network-scripts directory. Copy your ifcfg-eth0 role to ifcfg-eth0:0. Edit that file and rename the device to "eth0:0" and the IP address to the desired IP address. You may also want to modify BROADCAST, NETWORK, or NETMASK. You can continue adding IP addresses by using :1, :2, etc such as ifcfg-eth0:2.

To make it effective, you must reboot your system or issue the command "/etc/rc.d/init.d/network restart" as root.

Dynamically allocated IP addresses

To get the IP address of a dynamically allocated network interface in a script file enter the following:

dynip=`/sbin/ifconfig | grep -A 4 ppp0 | awk '/inet/ { print $2 } ' | sed -e s/addr://`
Substitute the correct interface that you get your dynamic IP address in for ppp0 in the example above. This script line gets your dynamic IP address for use in a masquerade script. You can use the variable $dynip as in any other configuration. The next time you make a new connection you will need to extract the dynip value again and re-run the masquerade script.

Networking file formats, examples and considerations

Below are listed some more in depth information about the networking files.
  • /etc/sysconfig/network
    The /etc/inittab file contains the entry "si::sysinit:/etc/rc.d/rc.sysinit" which causes the system at startup to run the rc.sysinit script. The rc.sysinit file expects to find the file /etc/sysconfig/network if networking is to be enabled.
    The network file looks like this:
    NETWORKING=yes
    FORWARD_IPV4=false
    HOSTNAME=mymachine.mycompany.com
    DOMAINNAME=mycompany.com
    GATEWAY=192.168.1.1
    GATEWAYDEV=eth0
    Where GATEWAYDEV is the network interface card that is attached to the network the gateway machine is on. The GATEWAY is the actual IP address of the gateway machine.

  • /etc/hosts - Defines local hosts.
    127.0.0.1 localhost localhost.localdomain
    192.168.1.100 mymachine.mycompany.com mymachine
    
  • /etc/services - Internet network services list. It associates port numbers with names of services. The file contains three fields which are name, port/protocol, and aliases with an optional comment.
  • /etc/protocols - Describes DARPA internet protocols available from the TCP/IP subsystem. Maps protocol ID numbers to protocol names. It includes protocol name, number, and aliases. The protocol file on my system:
    # /etc/protocols:
    # $Id: protocols,v 1.1 1995/02/24 01:09:41 imurdock Exp $
    #
    # Internet (IP) protocols
    #
    # from: @(#)protocols 5.1 (Berkeley) 4/17/89
    #
    # Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992).
    
    ip 0 IP  # internet protocol, pseudo protocol number
    icmp 1 ICMP  # internet control message protocol
    igmp 2 IGMP  # Internet Group Management
    ggp 3 GGP  # gateway-gateway protocol
    ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
    st 5 ST  # ST datagram mode
    tcp 6 TCP  # transmission control protocol
    egp 8 EGP  # exterior gateway protocol
    pup 12 PUP  # PARC universal packet protocol
    udp 17 UDP  # user datagram protocol
    hmp 20 HMP  # host monitoring protocol
    xns-idp 22 XNS-IDP  # Xerox NS IDP
    rdp 27 RDP  # "reliable datagram" protocol
    iso-tp4 29 ISO-TP4  # ISO Transport Protocol class 4
    xtp 36 XTP  # Xpress Tranfer Protocol
    ddp 37 DDP  # Datagram Delivery Protocol
    idpr-cmtp 39 IDPR-CMTP # IDPR Control Message Transport
    rspf 73 RSPF  #Radio Shortest Path First.
    vmtp 81 VMTP  # Versatile Message Transport
    ospf 89 OSPFIGP  # Open Shortest Path First IGP
    ipip 94 IPIP  # Yet Another IP encapsulation
    encap 98 ENCAP  # Yet Another IP encapsulation
    
  • /etc/named.conf - Used for domain name service to configure named. Other files used are dependent on this file. This file is explained further in the DNS section
  • /etc/resolv.conf - Specifies the domain to be searched for host names to connect to, the nameserver address, and the search order for the nameservers.
    domain mycompany.com
    search mycompany.com mynet.net
    nameserver 192.168.1.100
    nameserver 192.168.199.1
    nameserver 192.168.1.10
    
    The third line specifies that DNS should be tried on my machine first then use the normal nameserver on the fifth line. The fourth line specifies that my machine is running nameservices on another network which is using interface 192.168.199.1. This assumes the nameserver is set up on my machine which is explained in another section.
  • /etc/host.conf - Specifies the order nameservice looks to resolve names. An example file:
     order hosts, bind
     multi on
     nospoof on
    
    The order specifies that when resolving names to first look in the /etc/host file, then use BIND8 (DNS) to resolve the name. The line "multi on" specifies that all valid addresses for a host found in the hosts file should be returned.
The files in /etc/sysconfig/network-scripts control your network interfaces. The network interface file is described above in the section "Manual Configuration". If you want or need more in depth knowledge about how these files are used, you will need to read the document "How Linux Works CTDP Guide" or "The CTDP Linux Startup Manual". Otherwise you will need to analyze the system startup scripts which is no small task.

Older X windows configuration

In Xwindows a working configuration is set up as follows:
NAMES:
hostname: mymachine.mycompany.com
Domain: mycompany.com
Nameservers: 192.168.1.10
HOSTS:
IP - 192.168.1.100
Name - mymachine.mycompany.com
INTERFACES:
Interface - eth0
IP- 192.168.1.100
proto - none
atboot - yes
Netmask: 255.255.255.0
Network: 192.168.1.0
Broadcast: 192.168.1.255
ROUTING:
Default gateway: 192.168.1.1
Default gateway device: eth0
Interface - 192.168.1.100
Network Address - 192.168.1.0
Network gateway 192.168.1.1
Netmask - 255.255.255.0

Routing

Routing table information is used to route incoming and outgoing network diagrams to other machines. On most simple configurations, there are three routes. One for sending packets to your own machine, one for sending packets to other machines on your network and one for sending packets to other machines outside your network through the gateway. Two programs (ifconfig and route) are used to configure these parameters. They are described in more detail in the routing section.

Enable SSH in ESX Server


Login by user Root, after that, use command:
-      perl -spi -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config
-      esxcfg-firewall -e sshClient
-      service sshd restart

Changing the IP address, default gateway, and hostname of the Service Console in ESX

Details

This article provides steps to change the Service Console IP address, gateway address, and hostname on an ESX 3.x and 4.x host.

Solution

Note: ESX 4.0 Update 2 introduces a new tool that simplifies the process of creating or restoring networking in the ESX service console. For more information, see Configuring or restoring networking from the ESX service console using console-setup (1022078).
Note: To change the IP network information on an ESXi host, see   Configuring the ESXi Management Network from the direct console (1006710)
.

Changing settings from the physical or remote console connection

Changing the IP for the Service Console must be done from the physical console or through a remote console session. If you make changes through a network connection such as SSH, network connectivity to the Service Console disconnects because the Service Console's network interface changes.
  1. Run this command to set the IP address:

    [root@server root]# esxcfg-vswif -i a.b.c.d -n w.x.y.z vswif0
    where a.b.c.d is the IP address and w.x.y.z is the subnet mask.

    Note: In this example, vswif0 is the Service Console adapter that is the interface to which you are applying the IP address change.

  2. Open the /etc/hosts file with a text editor and modify it so that it reflects the correct IP address and hostname.

    Note: You may also need to verify and change the file /etc/vmware/esx.conf file for the hostname and IP address.

  3. To change the default gateway address and the hostname, edit the /etc/sysconfig/network file and change the GATEWAY and HOSTNAME parameters to the proper values.
  4. For the changes to take place, restart the network service with the command:

    [root@server root]# service network restart

    Note: If you are required to edit the hostname, then you must reboot the host.

    Note: This command breaks any current network connections to the Service Console, but virtual machines continue to have network connection. If the ESX host is managed by VirtualCenter or vCenter Server, you may have to remove and re-add the host to the inventory. For more information, see ESX not working properly in VirtualCenter after IP address change (1005633).
Note: Making changes to IP and DNS server settings can have a negative impact on the normal operation of ESX/ESXi, particularly in HA clustered environments. For more information, see Identifying issues with and setting up name resolution on ESX/ESXi Server (1003735).
Note: If the changed IP does not persist across a reboot, try deleting and recreating the Service Console vswif management interface. For more information, see Recreating Service Console networking from the command line (1000266).

Changing the hostname without rebooting

To dynamically change the hostname, run the command:
[root@server root]# hostname newname
Note: This command creates a temporary hostname change. This change is lost when the system is rebooted.

Changing the DNS server settings

To change the DNS server settings, update the nameserver IPs and search domain in the /etc/resolv.conf file.

Changing settings in VMware vSphere or Infrastructure Client

To change the hostname, domain, DNS servers, and default gateway in VMware vSphere or Infrastructure Client:
  1. Highlight the ESX host and click the Configuration tab.
  2. Click DNS and Routing.
  3. Click Properties.
  4. To change the hostname, domain, and DNS servers, click the DNS Configuration tab and enter the appropriate values.

    Note: Disable VMware High Availability if you do not want virtual machines to failover during the hostname IP change.

  5. To change the default gateway, click the Routing tab and enter the appropriate value.
  6. Reboot the ESX host for the changes to take effect .
  7. Reconnect the ESX host to vCenter Server with the new IP address.

Generating new certificates for the ESX host

The ESX host generates certificates the first time the system is started. Under certain circumstances, it might be required to force the host to generate new certificates. Typically new certificates only need to be generated if the hostname has been changed or the certificates have been deleted accidentally.
Each time you restart the vmware-hostd process, the mgmt-vmware script searches for existing certificate files ( rui.crt and rui.key). If the files cannot be found, new certificate files are generated.
To generate new certificates:
  1. Put the host into Maintenance Mode.
  2. In the directory /etc/vmware/ssl, back up any existing certificates by renaming them with these commands:

    [root@server root]# mv /etc/vmware/ssl/rui.crt /etc/vmware/ssl/orig.rui.crt
    [root@server root]# mv /etc/vmware/ssl/rui.key /etc/vmware/ssl/orig.rui.key


    Note: If you are regenerating certificates because you accidentally deleted them, you do not have to rename them.

  3. Reboot your host to allow it to begin using the new certificate, or restart the host services:

    1. Restart hostd, using this command:

      service mgmt-vmware restart
    2. Restart vmkauthd, using this command:

      service vmware-vmkauthd restart
  4. Exit Maintenance Mode.
  5. Confirm that the ESX host successfully generated new certificates by running this command and comparing the time stamps of the new certificate files with orig.rui.crt and orig.rui.key:

    [root@server root]# ls -la /etc/vmware/ssl/rui*
Notes:

Thứ Hai, 23 tháng 7, 2012

SQLDMO has not been registered, please re-run SQL Server setup and contact your system administrator

Question:
When I running the Microsoft sql server enterprise manager, it raise an error of "SQLDMO has not been registered, please re-run SQL Server setup and  contact  your system administrator." What is the problem. My sql server has already been installed and it runs very well until today.
Answer:
To solve this problem is an easy way. That is, at the Command prompt, run this command line: regsvr32 sqldmo.dll. Well, notice that if the command can not be successfully executed, then you might have to switch to the folder (use command 'cd') where the dll file lives.
Note: SQLDMO.dll was released along with the SQL Server2000. SQLDMO.dll is a COM object. SQLDMO is an SQL Distributed Management Objects, also an SQL Distributed Management Objects. It package the database objects of Microsoft SQL Server 2000. SQL-DMO support an Automation or COM-language applications to manage all parts of the SQL Server installation. SQL-DMO is the application programming interface(API) used by SQL Server Enterprise Manager. Therefore, using an SQL-DMO application can perform all the functions that SQL Server Enterprise Manager could perform.

Thứ Hai, 9 tháng 7, 2012

FIX: Error message when you try to install SQL Server 2000: "Unable to validate product key"

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To resolve this problem, follow these steps:
  1. In the SQL Server Installation Wizard, click Cancel.
  2. Start Registry Editor. To do this, click Start, click Run, type regedt32, and then click OK.
  3. Locate and then double-click the SafeDllSearchMode registry entry.

    On a server that is running Windows Server 2003 or Windows Storage Server 2003, this registry entry is located under the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
    On a server that is running Windows 2000 with SP4, this registry entry is located under the following registry subkey:
    HKEY_LOCAL_MACHINE\System\Control\Session Manager
    Note If the SafeDllSearchMode registry entry does not exist, create the SafeDllSearchMode registry entry as the DWORD value.
  4. In the Value data box, change the value from 1 to 0, and then click OK.
  5. Exit Registry Editor.
  6. Reinstall SQL Server 2000, and then install the latest SQL Server 2000 service pack.
  7. Restart the server.