Saturday, July 21, 2012

configure a system to use two different networks


Question: 

How we can configure a system to use two different networks.

Requirements:




  • Red Hat Enterprise Linux or *nix OS
  • A system with two Network Interface Cards (NICs)
  • Two different networks


  • Solution:




    • Edit the file  /etc/sysconfig/network and fill in the values of the variables:
    NETWORKING=yes
    HOSTNAME=myhost.example.com
    Note: If necessary, remove or comment out the variable GATEWAY. Each NIC will have it's own gateway.
    • Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 and add the following variables with their corresponding values:
    DEVICE=eth0
    BOOTPROTO=none
    ONBOOT=yes
    NM_CONTROLLED=no
    USERCTL=no
    IPADDR=
    NETMASK=
    GATEWAY=
    PEERDNS=yes
    DNS1=
    DNS2=
    
    • Do the same for the file /etc/sysconfig/network-scripts/ifcfg-eth1:
    DEVICE=eth1
    BOOTPROTO=none
    ONBOOT=yes
    NM_CONTROLLED=no
    USERCTL=no
    IPADDR=
    NETMASK=
    GATEWAY=
    PEERDNS=yes
    DNS1=
    DNS2=
    
    The values between '<' and '>' are dependent on your network.
    The variables PEERDNSDNS1 and DNS2 are optional. If you have the same DNS servers for both networks, you should put the nameservers IPs in the file /etc/resolv.conf, and in both ifcfg-eth?files remove the variables DNS1 and DNS2 and setPEERDNS=no.
    • Restart the network service:
    # service network restart

    Thanks!

  • Kubernetes 1.31 || Testing the Image Volume mount feature using Minikube

    With Kubernetes new version 1.31 ( https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/ ) there are so many features releases for...