Friday, September 15, 2023
What is the difference between exec and fork?
1. fork starts a new process which is a copy of the one that calls it, while exec replaces the current process image with another (different) one.
2. Both parent and child processes are executed simultaneously in case of fork() while Control never returns to the original program unless there is an exec() error.
Thursday, August 24, 2023
Linux Performance trouble shooting
Saturday, July 1, 2023
How to upgrade the Firmware in Fortigate firewall
Fortigate Model: FG_100E / FG_100F
Ensure you have downloaded the required incremental firmware for the fortigate model FG_100F as per the below upgrade path:
6.4.3-b1778 => 6.4.5-b5651 => 6.4.7-b1911 => 6.4.8-b1914
1. Login to VPN if available.
2. Login to the FortiGate Firewall: https://<IP-ADDR>
3. Take configuration backup
Login to FortiGate >> Dashboard >> System Information widget >> Backup >> Local PC >> OK >> fg100f-<hostname>_xxxx.conf
4. Navigate to System >> Firmware >> Check Current version say for instance: FortiOS v6.4.2 build1723 (GA) >> Upload Firmware >> Select File: Browse >> 6.4.5-b5651 >> Enable the HA sync option if available (But currently its standalone) >> Click upload the firmware >> Ok
5. After the new firmware has been installed, the system reboots.
6. Repeat the above steps for Ver: 6.4.7-b1911 => 6.4.8-b1914
7. Upon completion check the Fortigate Firmware version on both Primary and Standby nodes.
Sunday, June 18, 2023
how to create bootable Macos
Tuesday, April 11, 2023
How to create a VPC in AWS with two instances of CentOS 9 using Terraform:
- Install Terraform on your local machine.
- Create a new directory for your Terraform project.
- Create a new file in the directory named "main.tf".
- Add the following code to "main.tf":
main.tf
provider "aws" {
region = "us-east-1"
}
resource "aws_vpc" "example_vpc" {
cidr_block = "10.0.0.0/16"
}
resource "aws_subnet" "example_subnet_1" {
vpc_id = aws_vpc.example_vpc.id
cidr_block = "10.0.1.0/24"
}
resource "aws_subnet" "example_subnet_2" {
vpc_id = aws_vpc.example_vpc.id
cidr_block = "10.0.2.0/24"
}
resource "aws_security_group" "example_sg_1" {
name_prefix = "example_sg_1"
vpc_id = aws_vpc.example_vpc.id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "example_sg_2" {
name_prefix = "example_sg_2"
vpc_id = aws_vpc.example_vpc.id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "example_instance_1" {
ami = "ami-0a5ae2501482eae54"
instance_type = "t2.micro"
subnet_id = aws_subnet.example_subnet_1.id
vpc_security_group_ids = [aws_security_group.example_sg_1.id]
}
resource "aws_instance" "example_instance_2" {
ami = "ami-0a5ae2501482eae54"
instance_type = "t2.micro"
subnet_id = aws_subnet.example_subnet_2.id
vpc_security_group_ids = [aws_security_group.example_sg_2.id]
}
Note: In this example, we are using the US East 1 region, so please change it to the region of your choice.
- Save the file.
- Initialize your Terraform project by running
terraform initin your project directory. - Create a plan for your infrastructure by running
terraform plan. - Apply the changes to create your VPC and instances by running
terraform apply. - Once the instances have been created, you can access them via SSH using their public IP addresses.
And that's it! You should now have a VPC with two instances of CentOS 9 running in AWS, created using Terraform.
From chat GPT.
Create a VPC in AWS with two instances of Centos 9
- Log in to your AWS Console.
- Navigate to the VPC Dashboard by clicking on the "Services" menu at the top of the page and selecting "VPC."
- Click on the "Create VPC" button.
- Enter a name for your VPC and specify the CIDR block that you want to use. For example, you can use "10.0.0.0/16".
- Click on "Create".
- Now, navigate to the "Subnets" section of the VPC dashboard.
- Click on the "Create subnet" button.
- Enter a name for your subnet, select the VPC you just created, and choose a CIDR block for your subnet. For example, you can use "10.0.1.0/24".
- Repeat steps 7 and 8 to create a second subnet with a different CIDR block. For example, you can use "10.0.2.0/24".
- Now, navigate to the "Security Groups" section of the VPC dashboard.
- Click on the "Create Security Group" button.
- Enter a name for your security group, select your VPC, and configure the inbound rules to allow SSH traffic.
- Repeat step 11 and 12 to create a second security group for the second instance.
- Now, navigate to the "EC2" section of the AWS console.
- Click on the "Launch Instance" button.
- Select "CentOS 9" as your operating system and choose an instance type.
- Choose the first subnet you created in step 8.
- Select the first security group you created in step 12.
- Click on "Launch Instance".
- Repeat steps 15-19 to launch a second instance in the second subnet with the second security group.
Created from Chat GPT.
Monday, April 10, 2023
How to get the information on unreadable blocks on the disk
.
How to check TCP UDP and Unix sockets open ports .
netstat -ntlp # open TCP sockets
netstat -nulp # open UDP sockets
netstat -nxlp # open Unix sockets