Tag: ipv4

Network Basics: OSPF Standup and Route Sharing Process

Network Basics: OSPF Standup and Route Sharing Process

Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP) networks. It uses a link state routing (LSR) algorithm and falls into the group of interior gateway protocols (IGPs), operating within a single autonomous system (AS). It is defined as OSPF Version 2 in RFC 2328 (1998) for IPv4.

Below is a digram showing you the process flow of two routers initialising and sharing routes between each other within the same OSPF area

OSPF Int and Share

Advertisements
PS: Changing NIC IP Configuration

PS: Changing NIC IP Configuration

Okay, so it’s taken me a fair while of time to get this script to work needed for one of my latest projects so due to it taking me a while to piece this together I feel that it’s probably worthwhile putting it out on here for you guys to use if you wish. The following code will change the IP of a NIC and reconfigure the DNS settings using NETSH

 <# Get Network Adapter #>
Get-NetAdapter | Format-Table -AutoSize
<# User Input Network Interface #>
write-host 'Please Enter Network Interface Name: ' -ForegroundColor Yellow -NoNewline
$nicname = Read-Host
Write-host 'Please Enter New Host IP: ' -ForegroundColor Yellow -NoNewline
$NewIP = Read-Host
Write-host 'Please Enter New Subnet Mask: ' -ForegroundColor Yellow -NoNewline
$NewMask = Read-Host
Write-Host 'Please Enter New Gateway: ' -ForegroundColor Yellow -NoNewline
$NewGate = Read-Host
Write-Host 'Please Enter DNS Server 1: ' -ForegroundColor Yellow -NoNewline
$NewDNS1 = Read-Host
Write-Host 'Please Enter DNS Server 2:' -ForegroundColor Yellow -NoNewline
$NewDNS2 = Read-Host
write-host 'Setting New IPv4 Configuration'
& "$env:windir\system32\netsh.exe" interface ipv4 set address $nicname static $NewIP $NewMask $NewGate
write-host 'Removing Exsisting DNS Config'
& "$env:windir\system32\netsh.exe" interface ip delete dns $nicname all
write-host 'Adding New DNS Config'
& "$env:windir\system32\netsh.exe" interface ipv4 set dns name=$nicname source=static address=$NewDNS1 primary validate=no
& "$env:windir\system32\netsh.exe" interface ipv4 add dnsserver name=$nicname address=$NewDNS2 index=2 validate=no